I don't see any problem with this code here? I have tried and it correctly sets the page in landscape when the page checkbox is checked.
Can you review your hard disk and verify you have no old dcus/bpls hanging around? We changed the destination folder in this new version to adapt to the new XE2 settings, so you need to make sure to uninstall the old version, and completely delete the FlexCel folder before installing the new one.
I'd love to attach my test case here, but I can't find an "attach" button...
But is is mostly what you wrote. The form has 1 button, 2 checkboxes, a flexcelimport and an xlsadapter. Code is as follows:
unit Unit8;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
UExcelAdapter, XLSAdapter, UFlexCelImport, ActiveX, UFlxMessages;
type
TForm8 = class(TForm)
Button1: TButton;
FlexCelImport: TFlexCelImport;
XLSAdapter1: TXLSAdapter;
cbLandscape: TCheckBox;
cbPrintToFit: TCheckBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form8: TForm8;
implementation
{$R *.dfm}
procedure TForm8.Button1Click(Sender: TObject);
var
FileName : string;
begin
FlexCelImport.NewFile(1);
FlexCelImport.CellValue[1,1] := 1;
if cbLandscape.Checked then
//Landscape
FlexCelImport.PrintOptions := FlexCelImport.PrintOptions and not fpo_nopls and (not fpo_Orientation)
else
//Portrait
FlexCelImport.PrintOptions := FlexCelImport.PrintOptions and not fpo_nopls or (fpo_Orientation);
//page scale margins etc.
if cbPrintToFit.Checked then
begin
FlexCelImport.printtofit:=true;
// FlexCelImport.printscale:=trunc(printersettings.scale.Columns[0].selectedvalue);
end else
begin
FlexCelImport.printtofit:=false;
FlexCelImport.printscale:= 100;
end;
FileName := IncludeTrailingPathDelimiter(GetEnvironmentVariable('TEMP')) + 'test.xls';
FlexCelImport.Save(FileName);
end;
end.
If you want email me and I can send you a zip with the example. I tested the 4 combinations here and they all work fine. Do you have anything different in your setup?