Page 1 of 1

Using Services via OLE/COM

PostPosted: Tue Dec 10, 2019 4:21 pm
by PiJon
I have a special framework with pascal-similar language.
I'm trying to export some data to OpenOffice Calc.

Code: Select all   Expand viewCollapse view
var App, Instance, Document, Sheet, Cell : variant;

  App := CreateOLEObject('');
  Instance := App.createInstance('');
  Document := Instance.loadComponentFromURL('private:factory/scalc', '_blank', 0, args);
  Sheet := Document.createInstance('');
  Document.Sheets.insertByName('MySheet', Sheet);
  Cell := Sheet.getCellbyPosition(2, 3);
  Cell.String := 'Test Text';

it works correct.
Now I want to justify text in the cell to the right.
Formatting Spreadsheet Documents:
Special cell formatting is handled by the service.
HoriJustify (enum): horizontal justification of the text (value from

How can I do it?
Cell.CellProperties? OLE Object doesn't have method CellProperties
Cell.createInstance('')? OLE Object doesn't have method...
App.createInstance('')? Unsupported type of returned value.

Is the latter way correct? Probably the problem is in my framework.


Re: Using Services via OLE/COM

PostPosted: Tue Dec 10, 2019 6:03 pm
by Zizi64
Open a prepared template (instead of a new, blank document based on the default template)
and apply an existing, user defined Cell style (instead of the direct formatting method).