Bonjour, quelqu'un pourrait m'aider s'il vous plaît avec ce qui suit, j'essaie de créer un tableau de calcul OpenOffice en utilisant l'interface OOoTools.pas. Le code est le suivant:OpenOffice Automation créer un graphique dans calc en utilisant Delphi
/////////////////////////////// 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 //////////////////////////////////
Dans l'appel oCharts.addNewByName j'obtiens une erreur « Type mismatch » et ne pas avoir plus d'information ce qui pourrait être erroné. Ou dois-je utiliser une autre approche? Merci beaucoup pour votre aide.
fonctionne comme un charme, merci beaucoup! – addelichtman