I am new to delphi and i am struggling to print out an excel spreadsheet from a tXLSBookPrint component. It prints out ok but it prints too wide and it prints on 2 sheets of paper instead of 1.
here is my code if anyone can help.
procedure TForm1.Button2Click(Sender: TObject);
begin
if PrintDialog1.Execute then begin
XLSBookPrint1.XLS := XLSSpreadSheet1.XLS;
XLSBookPrint1.PrinterName := Printer.Printers[Printer.PrinterIndex];
if (PrintDialog1.FromPage > 0) and (PrintDialog1.ToPage > 0) then
XLSBookPrint1.Print(PrintDialog1.FromPage,PrintDialog1.ToPage)
else
XLSBookPrint1.Print;
end;
end;
here is my code if anyone can help.
procedure TForm1.Button2Click(Sender: TObject);
begin
if PrintDialog1.Execute then begin
XLSBookPrint1.XLS := XLSSpreadSheet1.XLS;
XLSBookPrint1.PrinterName := Printer.Printers[Printer.PrinterIndex];
if (PrintDialog1.FromPage > 0) and (PrintDialog1.ToPage > 0) then
XLSBookPrint1.Print(PrintDialog1.FromPage,PrintDialog1.ToPage)
else
XLSBookPrint1.Print;
end;
end;