Propagating Page properties of a server generated "Telerik.Windows.Documents.Spreadsheet.Model.Workbook" in a web rendered "Telerik.Web.Spreadsheet.Workbook"
Heads up, this is only for licensed developers who can access the commercial library source code.
At present the documents.spreadsheet workbook has a richer capacity than a web.spreadsheet workbook, especially around page setting. I don't know the roadmap, but expect at some point the web Spreadsheet component will take on a richer feature set that aligns with Excel application.
A Telerik document workbook is converted to it's web version for viewing in a browser by using the FromDocument() method. The features that are lost from the sheets of the original document workbook include:
- page orientation
- headers and footers
The listed items are those I wanted to deal with, there may be more but they were of no concern to me at this time.
My project has a Controller/ViewModel
and a View
At this point the Spreadsheet component in the browser will display the spreadsheet that was created server side.
The component has a download button and you can select to download as an .xlsx.
Because web spreadsheet model does not implement page setup features. The FromDocument() conversion works, but all the page properties info in the document spreadsheet is ignored.
How can this be remedied ?
1. Explicitly add the original pageSetup features to the converted object.
2. Modify library source code to render pageSetup features in the Excel xml that becomes the download.
After the web spreadsheet (as a FromDocument) is rendered, the document page properties can be explicitly reattached by code in a kendo.syncReady funtion.
For example, at bottom of the View, add a script block:
Step 2. Modify kendo.all.js
This is for licensed developers only.
Patch your licensed copy of the commercial library source code (v 2017.3.1026) with the attached patch file.
The view must include the modified library code that has been copied into your asp-net mvc project, and can not use the minified cdn version. The original licensed kendo-ui complete library source code can be downloaded from your account login.
Now when you download your richly featured server side generated spreadsheet from the view it will still contain those rich features.