OpenOffice

You are currently browsing the articles from KomKid.Net matching the category OpenOffice.

Axapta : Sending data to OpenOffice Calc by X++ using OOCALCVB.dll

วิธีการนี้ต้องใช้ตัวช่วยคือ OOCALCVB.dll
1.Download DLL OOCALCVB.dll ไปไว้ในเครื่อง ปกติก็คือที่ C:\Windows\System32\

2.ใน Axapta เลือกเมนู Tools > Development tools > Wizards > COM Class Wrapper Wizard
2009-08-13_141006

3.คลิก Next แล้วก็ Brows หาไฟล์ในข้อ 1 แล้วก็คลิก Next

4.ป้อน oo ตรงช่อง Element Mask เพื่อเอาไว้สังเกต Classes ที่จะได้ แล้วคลิก Next จะได้รายการของ Class ที่เกิดจาก OOCALCVB.dll
2009-08-13_141552

5.คลิก Next แล้วรอจนเสร็จ ก็คลิก Finish

6.เปิดดู AOT จะเห็นว่ามี Class ใหม่เกิดขึ้นมาดังรูป
2009-08-13_141822

ต่อไปก็ลองเขียน X++ ติดต่อดู ดังตัวอย่าง

1
2
3
4
5
6
7
8
9
10
    ooCalc              ooCalc;
    #ooCOMDEF
   ;

   ooCalc          = new ooCalc();
   ooCalc.Workbooks().OpenFile("\\\\Axaptaserver\\AxaptaSP4\\Excel\\Losses.xls",false,"",false);

    ooCalc.ActiveWorkbook().ActiveSheet().Cells().Item("A1").Value(66);
//    ooCalc.ActiveWorkbook().ActiveSheet().Cells().Item("A1").SetString(strfmt("Losses of %1 from %2 to %3",fromDate,toDate)); //SetString อันนี้ใช้ไม่ได้
    ooCalc.ActiveWorkbook().ActiveSheet().Cells().Item("A1").Formula(strfmt("Losses of %1 from %2 to %3",fromDate,toDate)); //SetString ไม่ได้ ใช้ Formula แทนไปก่อน

Written by Komkid on August 13th, 2009 with no comments.
Read more articles on Axapta and OpenOffice and Programming.

No older articles

Newer articles »