Axapta : Open OpenOffice document and Save as

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    COM OpenOffice;
    COM oDeskTop;
    COM oDocument;
    COMVariant arg;
    COMVariant byte;
    Array Arr = new Array(Types::Class);
    Array oArr = new Array(Types::Class);
    str url,outFile;
    COM FileProperties;
;
    OpenOffice = new Com("com.sun.star.ServiceManager");
    oDeskTop = OpenOffice.CreateInstance("com.sun.star.frame.Desktop");
 
// #############################################################
// เปิดไฟล์
    arg = comVariant::createFromArray(Arr);
    url = "file://Axaptaserver/AxaptaSP4/Excel/Losses.xls";
    oDocument = oDeskTop.LoadComponentFromURL(url, "_blank", 0, arg);
// #############################################################
 
// #############################################################
// Save as เป็นอีกไฟล์
    FileProperties = OpenOffice.Bridge_GetStruct('com.sun.star.beans.PropertyValue');
    FileProperties.Name('Overwrite');
    FileProperties.Value(true);
    oArr.value(1,FileProperties);
    arg = comVariant::createFromArray(oArr);
    outFile = "file:///C:/Losses.xls";
    oDocument.storeAsURL(outFile,arg);
// #############################################################

Written by Komkid on November 22nd, 2009 with no comments.
Read more articles on Axapta and OpenOffice and Programming.

Related articles

No comments

There are still no comments on this article.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:

You have to be identified to write a comment.