This is a migrated thread and some comments may be shown as answers.

ASP.Net SpreadProcessing

3 Answers 118 Views
SpreadProcessing
This is a migrated thread and some comments may be shown as answers.
Sandra Walters
Top achievements
Rank 1
Sandra Walters asked on 29 Aug 2015, 07:32 PM

I want to set the paper type and ScaleFactor of worksheet but the code below for papertype and scalefactor does not compile.  I would like some help with this.

WorksheetPageSetup pageSetup = wb.ActiveWorksheet.WorksheetPageSetup;

pageSetup.Margins = new PageMargins(25.00, 25.00, 25.00, 25.00);

pageSetup.PaperType = PaperType.Letter;

pageSetup.ScaleFactor = new Size(0.9, 0.9);

3 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 01 Sep 2015, 03:06 PM
Hello Sandra,

There is a typo in the snippet - the enumeration with the PaperType values is called PaperTypes

Another reason to experience similar issue could be a missing namespace. For your I am the same snippet with added the namespaces of the used classes:
Telerik.Windows.Documents.Spreadsheet.Model.Printing.WorksheetPageSetup pageSetup = this.radSpreadsheet.Workbook.ActiveWorksheet.WorksheetPageSetup;
pageSetup.Margins = new Telerik.Windows.Documents.Spreadsheet.Model.Printing.PageMargins(25.00, 25.00, 25.00, 25.00);
pageSetup.PaperType = Telerik.Windows.Documents.Model.PaperTypes.Letter;
pageSetup.ScaleFactor = new System.Windows.Size(0.9, 0.9);

Hope this helps.

Regards,
Tanya
Telerik
0
Sandra Walters
Top achievements
Rank 1
answered on 01 Sep 2015, 03:52 PM

Thanks very much for the clarification on PaperTypes.  I am still seeing an error with the Scaling Factor.

pageSetup.ScaleFactor = new System.Windows.Size(0.9, 0.9);

 the type or namespace name "Size" does not exist in the namespace "System.Windows".  I am not given an opportunity to 'resolve' and I tried adding a specific reference to System.Windows.

 

 

0
Accepted
Tanya
Telerik team
answered on 04 Sep 2015, 10:02 AM
Hi Sandra,

This error occurs as a result of a missing reference. In order to use the Size class from the System.Windows namespace you need to add a reference to the WindowsBase assembly in your project.

Regards,
Tanya
Telerik
Tags
SpreadProcessing
Asked by
Sandra Walters
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Sandra Walters
Top achievements
Rank 1
Share this question
or