在 OpenOffice Calc 中以编程方式更改打印区域
Changing programmatically print area in OpenOffice Calc
我正在使用 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")
Set mPrintOptions(2) = MakePropertyValue(oServiceManager, "PrintRepeatCol", "$A")
OO_Dispatcher.executeDispatch oDeskTop, ".uno:ChangePrintArea", "", 0, mPrintOptions
我在保存的文档中获得了制作宏的代码。
服务管理器和桌面对象以前是实例化的。文档创建正常,但当我将它发送到打印机时,它不会重复我在上面指定的行和列。
我在这里找到了我的解决方案:
我的代码最终变成了这样:
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
我正在使用 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")
Set mPrintOptions(2) = MakePropertyValue(oServiceManager, "PrintRepeatCol", "$A")
OO_Dispatcher.executeDispatch oDeskTop, ".uno:ChangePrintArea", "", 0, mPrintOptions
我在保存的文档中获得了制作宏的代码。
服务管理器和桌面对象以前是实例化的。文档创建正常,但当我将它发送到打印机时,它不会重复我在上面指定的行和列。
我在这里找到了我的解决方案:
我的代码最终变成了这样:
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