Page 1 of 1

Printsettings FitWidth and FitHeight

Posted: Wed Jun 21, 2006 6:54 am
by Guest
If I set the

ASheet.PrintSettings.FitWidth := 1;

this is not shown in the printsettings when I open the sheet in Excel. Do I have to set an options for this to work ?

Thanks in advance !

Posted: Wed Jun 21, 2006 8:49 am
by larsa
Hello

Sorry, yes. In order to activate this, TSheet.WorkspaceOptions must have the value woFitToPage.
Example:

Code: Select all

XLS.Sheet[0].PrintSettings.FitWidth := 3;
XLS.Sheet[0].WorkspaceOptions := XLS.Sheet[0].WorkspaceOptions + [woFitToPage];
Lars Arvidsson

Re: Printsettings FitWidth and FitHeight

Posted: Wed Apr 07, 2010 3:05 pm
by pwest777
I am trying to use this option in C++ Builder...

XLS->Sheets->Items[0]->PrintSettings->FitHeight = 999;
XLS->Sheets->Items[0]->PrintSettings->FitWidth = 1;

XLS->Sheets->Items[0]->WorkspaceOptions << woFitToPage;

When I look at the Excel File the fit height = 999 and width = 1, but the "Fit To:" option is not selected... It is still set to the "Adjust To:" setting... Am I doing something wrong? I have tried to set the woFitToPage option before setting the FitHeight and FitWidth, but I still get the same results.

Thank you.

Re: Printsettings FitWidth and FitHeight

Posted: Thu Jun 10, 2010 4:36 pm
by pmarin
The correct statement for C++ Builder is below:

XLS->Sheets->Items[sheet]->WorkspaceOptions =
XLS->Sheets->Items[sheet]->WorkspaceOptions << woFitToPage;