หน้าเว็บ

วันจันทร์ที่ 26 ธันวาคม พ.ศ. 2559

VB : VB Set Style To LibreOffice Calc And Print To Other Sheet.

VB : VB Set Style To LibreOffice Calc And Print To Other Sheet.

http://www.mediafire.com/?x9qjrd5n7u7jytl

 VB : VB Set Style To LibreOffice Calc And Print To Other Sheet.


  1.             Dim Result(-1) As Object
  2.             Dim CurrLine As String = String.Empty
  3.             Dim myDoc As Object, firstSheet As Object, secondSheet As Object  //Print To Sheet
  4.  
  5.             Dim oSM
  6.             Dim oDesk As Object
  7.             Dim arg(-1) As Double
  8.  
  9.             'Connect file and open OpenOffice
  10.             oSM = CreateObject("com.sun.star.ServiceManager")
  11.             oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
  12.  
  13.             ' Open calc
  14.             'myDoc = oDesk.loadComponentFromURL("private:factory/scalc", "_blank", 0, arg)
  15.             myDoc = oDesk.loadComponentFromURL("file://datacenter/Asset/Template/RP_Reports.ods", "_blank", 0, arg)
  16.             firstSheet = myDoc.Sheets.getByIndex(0) 'index sheet insert data.
  17.  
  18.             secondSheet = myDoc.Sheets.getByIndex(1) 'index sheet insert data.
  19.  
  20. //Select DATA We Need.
  21. //Print
  22.                             firstSheet.getCellByPosition(0, 0).setPropertyValue("CellStyle", "IntRed")
  23.                             firstSheet.getCellByPosition(0, 1).Value = myReader1.Item("In_price").ToString()
  24.  
  25.                             firstSheet.getCellByPosition(1, 1).setPropertyValue("CellStyle", "StrRed")
  26.                             firstSheet.getCellByPosition(1, 2).String = myReader1.Item("RPID").ToString()
  27.  
  28. //Print To Second  Seet
  29.  
  30.                             secondSheet.getCellByPosition(0, 0).setPropertyValue("CellStyle", "StrRed")
  31.                             secondSheet.getCellByPosition(0, 1).String = myReader1.Item("RPID").ToString()
  32.  
  33.                             secondSheet.getCellByPosition(1, 1).setPropertyValue("CellStyle", "IntRed")
  34.                             secondSheet.getCellByPosition(1, 2).Value = myReader1.Item("In_price").ToString()

ไม่มีความคิดเห็น:

แสดงความคิดเห็น