OOobbs/77
質問
OOoにはまり始めた佐藤です。よろしくお願いします。 印刷をマクロでやりたいのですが、タイトル列(行)をつけて印刷するのはどうすればよいか教えてください。 ちなみに以下のように書いてみましたが動きませんでした。 sub print_area dim odoc as object dim osheet as object dim arange as new com.sun.star.table.CellRangeAddress dim atitlecol as new com.sun.star.table.CellRangeAddress dim aprintop(0) as new com.sun.star.beans.PropertyValue odoc = thiscomponent osheet = odoc.sheets(1) with arange .sheet = 2 .startcolumn = 3 .startrow = 2 .endcolumn = 18 .endrow = 61 end with atitlecol = 2 osheet.settitlecolumus(array(atitlecol)) osheet.setprintareas(array(arange)) odoc.print(aoprintop()) end sub よろしくお願いします 回答
sub print_area dim odoc as object dim osheet as object dim arange as new com.sun.star.table.CellRangeAddress dim atitlecol as new com.sun.star.table.CellRangeAddress dim aprintop(0) as new com.sun.star.beans.PropertyValue odoc = thiscomponent osheet = odoc.sheets(1) with atitlecol .Sheet = 2 .StartColumn = 0 .StartRow = 0 .EndColumn = 0 .EndRow = 56 end with with arange .Sheet = 1 .StartColumn = 0 .StartRow = 1 .EndColumn = 22 .EndRow = 56 end with 'atitlecol = 2 osheet.settitlecolumns(atitlecol) osheet.setprinttitlecolumns(true) osheet.setprintareas(array(arange)) aprintop(0).Name = "Name" aprintop(0).Value ="いきなりPDF" ' プリンター名 odoc.print(aprintop()) ' <---- end sub osheet.settitlecolumns(atitlecol) ここの部分では,指定する .table.CellRangeAddress はシークエンスではないので,配列にする必要はありません。印刷範囲の場合には,複数指定が可能なのでシークエンスとして指定します。OOoBasic/Calc/printarea 次のようにしてタイトル行を使用するように設定します。OOoBasic/Calc/printarea osheet.setprinttitlecolumns(true)
|