I have a data manipulation application, which get data as a json and save it to .xlsx file.
Numbers, Boolean, Text and some formulas are saved to sheet as 2-diamentional array and store it as .xlsx file. There are 2 options in api. They are setDataArray and setFormulaArray(). I know it is not possible to set Formulas with setDataArray, i have to use setFormulaArray for this operation.
Do i have to use setDataArray for saving numbers?
What happens if i set numbers with setFormulaArray?
What is the main difference between setDataArray vs setFormulaArray()?
Just do your research - some simple test with values that you understand will give more information than our explanations.
Sub testSetArray
Dim oSheet As Variant
oSheet = ThisComponent.getCurrentController().getActiveSheet()
oSheet.getCellRangeByName("B2:F2").setFormulaArray(Array(Array("Foo"&"Bar","=""Foo""&""Bar""","2024-01-30",18,"=18")))
oSheet.getCellRangeByName("B4:F4").setDataArray(Array(Array("Foo"&"Bar","=""Foo""&""Bar""","2024-01-30",18,"=18")))
End Sub
Type of data passed to the method as a parameter
1 Like
Thank you for your interest. This helps me a lot to understand
Hallo
…additional: setFormulaArray() allows also numeric primitives in the Input!
The main-Difference is:
Calc evaluates Strings only from FormulaArray but never from DataArray
The other way round:
getFormulaArray casts anything to string
getDataArray returns the original Data