Printsettings FitWidth and FitHeight

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
Guest
Posts: 83
Joined: Tue Aug 16, 2005 6:08 pm

Printsettings FitWidth and FitHeight

Post 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 !
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Post 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
pwest777
Posts: 2
Joined: Wed Apr 07, 2010 3:00 pm

Re: Printsettings FitWidth and FitHeight

Post 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.
pmarin
Posts: 1
Joined: Tue Jan 10, 2006 8:08 pm

Re: Printsettings FitWidth and FitHeight

Post by pmarin »

The correct statement for C++ Builder is below:

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