Como Llamar BrOffice.org en lugar de Excel?
http://imgur.com/a/uyrqh
Gracias, saludos.
#include "FiveWin.ch"
function main ()
local oServiceManager
local oDesktop
local oDocument
local oSchedule
local oSheet
local oCell
local oColums
local oColumn
local a1
local a2
local i
// inicializa
oServiceManager := TOleAuto():New("com.sun.star.ServiceManager")
oDesktop := oServiceManager:createInstance("com.sun.star.frame.Desktop")
oDocument := oDesktop:loadComponentFromURL("private:factory/scalc","_blank", 0, {})
// obtem planilhas
oSchedule := oDocument:GetSheets()
// obtem a primeira planilha
// por nome
//oSheet := oSchedule:GetByName("Planilha1")
// ou
// por indice
oSheet := oSchedule:GetByIndex(0)
// meses
a1 := {"Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"}
// valores
a2 := {100,200,300,400,500,600,700,800,900,1000,1100,1200}
for i := 1 to 12
// escreve texto na linha I da coluna A
oCell := oSheet:getCellByPosition(0,i-1)
oCell:SetString(a1[i])
// escreve valor na linha I da coluna B
oCell := oSheet:getCellByPosition(1,i-1)
oCell:SetValue(a2[i])
oCell:NumberFormat := 2 // configura formato para 2 casas decimais
next i
// soma celulas de B1 a B12 usando uma formula
oCell := oSheet:getCellByPosition(0,13)
oCell:SetString("Total:")
oCell := oSheet:getCellByPosition(1,13)
oCell:Formula := "=SUM(B1:B12)"
oCell:NumberFormat := 2
return nil
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 23 guests