在 OpenOffice Calc 中创建图表
我正在尝试使用 OOoTools.pas 界面创建 OpenOffice Calc 图表。代码是这样的:
/////////////////////////////// CODE //////////////////////////////////
procedure TForm1.ProcessChart(aFilename : String);
Var
oTheFile, oAllSheets, oMySheet, oCharts,
oCellRangeAddress, oRectangle, oSize : Variant;
begin
ConnectOpenOffice;
oTheFile := OpenSheet(aFilename, True);
oAllSheets:= oTheFile.Sheets;
oMySheet:= oAllSheets.getByIndex(0); // first sheet of the spreadsheet
oCharts := oMySheet.getCharts;
oCellRangeAddress := oTheFile.Bridge_getStruct('com.sun.star.table.CellRangeAddress');
oCellRangeAddress.Sheet := 0;// '1ere feuille du graphique
oCellRangeAddress.StartColumn := 0;// 'Ligne 1
oCellRangeAddress.StartRow := 0;// 'Colonne A
oCellRangeAddress.EndColumn := 3;// 'Colonne D
oCellRangeAddress.EndRow := 29;// 'Ligne 30
oRectangle := oTheFile.Bridge_GetStruct('com.sun.star.awt.Rectangle');
oRectangle := oMySheet.Bridge_GetStruct('com.sun.star.awt.Rectangle');
oRectangle.X := 8000;
oRectangle.Y := 1000;
oRectangle.Width := 5000;
oRectangle.Height := 5000;
// Type Error Mismatch error on this call:
oCharts.addNewByName('LogData',
oRectangle,
oCellRangeAddress,
true,
true);
DisconnectOpenOffice;
End;
/////////////////////////////// END CODE //////////////////////////////////
在 oCharts.addNewByName
调用中,我收到“类型不匹配”错误,并且没有进一步的信息可能出现错误。
或者我必须使用另一种方法?
I am trying to create an OpenOffice Calc chart using the OOoTools.pas
interface. The code is this:
/////////////////////////////// CODE //////////////////////////////////
procedure TForm1.ProcessChart(aFilename : String);
Var
oTheFile, oAllSheets, oMySheet, oCharts,
oCellRangeAddress, oRectangle, oSize : Variant;
begin
ConnectOpenOffice;
oTheFile := OpenSheet(aFilename, True);
oAllSheets:= oTheFile.Sheets;
oMySheet:= oAllSheets.getByIndex(0); // first sheet of the spreadsheet
oCharts := oMySheet.getCharts;
oCellRangeAddress := oTheFile.Bridge_getStruct('com.sun.star.table.CellRangeAddress');
oCellRangeAddress.Sheet := 0;// '1ere feuille du graphique
oCellRangeAddress.StartColumn := 0;// 'Ligne 1
oCellRangeAddress.StartRow := 0;// 'Colonne A
oCellRangeAddress.EndColumn := 3;// 'Colonne D
oCellRangeAddress.EndRow := 29;// 'Ligne 30
oRectangle := oTheFile.Bridge_GetStruct('com.sun.star.awt.Rectangle');
oRectangle := oMySheet.Bridge_GetStruct('com.sun.star.awt.Rectangle');
oRectangle.X := 8000;
oRectangle.Y := 1000;
oRectangle.Width := 5000;
oRectangle.Height := 5000;
// Type Error Mismatch error on this call:
oCharts.addNewByName('LogData',
oRectangle,
oCellRangeAddress,
true,
true);
DisconnectOpenOffice;
End;
/////////////////////////////// END CODE //////////////////////////////////
In the oCharts.addNewByName
call I get a "Type Mismatch" error and have no further information what could be wrong.
Or must I use another approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
addNewByName 需要一个
com.sun.star.table.CellRangeAddress
并且您没有给出 CellRangeAddress 结构序列,而是给出结构本身。试试这个:
The aRanges parameter of addNewByName expects a sequence of
com.sun.star.table.CellRangeAddress
and you are not giving a sequence of CellRangeAddress structs, but the struct itself.Try this: