在OpenOffice Calc中以编程方式更改打印区域

问题描述 投票:1回答:1

我正在使用vb6快速创建Calc文档。打印时,我需要在每页中重复1行和1列。

这是代码:

 Dim mPrintOptions(2) As Object
 Dim OO_Dispatcher As Object
 Set OO_Dispatcher = oServiceManager.createInstance("com.sun.star.frame.DispatchHelper")
 Set mPrintOptions(0) = MakePropertyValue(oServiceManager, "PrintArea", "")
 Set mPrintOptions(1) = MakePropertyValue(oServiceManager, "PrintRepeatRow", "$A$2")
 Set mPrintOptions(2) = MakePropertyValue(oServiceManager, "PrintRepeatCol", "$A$1")

 OO_Dispatcher.executeDispatch oDeskTop, ".uno:ChangePrintArea", "", 0, mPrintOptions

我有这段代码在保存的文档中创建一个宏。

服务管理器和桌面对象是先前实例化的。可以很好地创建文档,但是当我将其发送到打印机时,它不会重复我在上面指定的行和列。

openoffice-calc libreoffice-basic openoffice-basic
1个回答
0
投票

我在这里找到了解决方案:

https://wiki.openoffice.org/wiki/ES/Manuales/GuiaAOO/TemasAvanzados/Macros/StarBasic/TrabajandoConCalc/Imprimiendo

我的代码终于变得像这样:

Dim OO_TitulosR As Object
Dim OO_ActiveSheet As Object
Set OO_TitulosR = OO_Document.Bridge_getStruct("com.sun.star.table.CellRangeAddress")
Set OO_ActiveSheet = OO_Document.getCurrentController.getActiveSheet
OO_TitulosR.StartColumn = 0
OO_TitulosR.EndColumn = 0
OO_TitulosR.StartRow = 1
OO_TitulosR.EndRow = 1
OO_ActiveSheet.setTitleColumns OO_TitulosR
OO_ActiveSheet.setTitleRows OO_TitulosR
© www.soinside.com 2019 - 2024. All rights reserved.