I just installed Delphi XE3. The previous version was XE. My program generates Excel files (I am using Office 2013). I imported Excel Type Library. When I using Delphi XE then this code is working. When I using Delphi XE3 then I got an error message, something like this: 'HorizontalAlignment property can not be set' What is changed in XE3?
Here is the code:
VAR Myworkbook, range, excelapp : olevariant;
Begin
ExcelApp:=CreateOleObject('Excel.Application');
ExcelApp.Visible:=true;
MyWorkbook:=ExcelApp.Workbooks.Add;
MyWorkbook.Activate;
MyWorkbook.Activesheet.PageSetup.Orientation := xlPortrait;
MyWorkbook.Activesheet.PageSetup.PaperSize := xlPaperA4;
MyWorkbook.Activesheet.PageSetup.LeftMargin := CMtoPT(1);
MyWorkbook.Activesheet.PageSetup.RightMargin := CMtoPT(1);
MyWorkbook.Activesheet.PageSetup.TopMargin := cmtopt(1.5);
MyWorkbook.Activesheet.PageSetup.BottomMargin := cmtopt(1.5);
Range:=ExcelApp.Range['A1','A1'];
Range.HorizontalAlignment := xlLeft;
Range.VerticalAlignment := xlCenter;
END
xlLeft
? What is the exact error? – David Heffernan