I wrote my first Calc macro today (and yesterday) and was immensely frustrated at not finding a reference source for the cell and sheet object properties. I am attempting to create a blank sheet and copy its general framework from another sheet in the same .xlsx file. Fortunately, Record Macro helped my create the new sheet (or I would have been completely lost), but was ineffective at dealing with any formatting. I realize the Record feature is acknowledged as very unreliable.
I was able to get data copied from the reference sheet with .formula and I finally found the right property names to get these cell formatting attributes (though the naming choices seems wildly divergent from broader practice):
Cell1 = Sheet1.GetCellbyPosition(iCol, iRow)
Cell2 = Sheet2.GetCellbyPosition(iCol, iRow)
Cell2.Formula = Cell1.Formula
Cell2.CharFont = Cell1.CharFont
Cell2.CharHeight = Cell1.CharHeight 'font size
Cell2.CharWeight = Cell1.CharWeight '+/- bold
Cell2.CharPosture = Cell1.CharPosture '+/- italic
Cell2.CharUnderline = Cell1.CharUnderline '+/- underscore
Cell2.NumberFormat = Cell1.NumberFormat
It took me many hours to ferret out the arcane property names and I still have quite a few yet to resolve, including:
How to set column widths from template sheet.
How to set row heights from template sheet.
How to set cell WrapText property from template sheet.
How to set cell text justification (left, right, center) from template sheet.
How to set page orientation (portrait/landscape) from template sheet.
How to set page header on/off from template sheet.
How to set page margin from template sheet.
How to set fit-to-page from template sheet.
So here’s my question: Where can I find a reference document for LO Calc version 4 that shows the cell and sheet property names?
It doesn’t have to be fancy.
Thanks.