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

Get data from WebService while using excel file as template

3 Answers 131 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Diego
Top achievements
Rank 1
Diego asked on 15 Nov 2018, 03:40 PM

Hello!

I'm trying to use a pre formatted xlsx file as a starting point for my spreadsheet, and then trying to load data from my webservice (using a DropDownList to select a year) into some of its cells, so that the user can change the value of those cells and then hit the save button so that I can retrieve both the values and the formulas of the edited cells. However, I'm having trouble finding a solution that covers all the steps required for my program to work:

1) I tried using the SpreadsheetDocumentProvider to load my xlsx document, but then I don't know how to both load the data into the resulting spreadsheet, and also overriding its save function so that I can retrieve the values and formulas of the cells.

2) I tried overriding the SpreadsheetDataBaseProvider, which lets me load info from my webservice and into the cells I want, however I don't know how to load the format of my xlsx file, tell it which value is selected in the "Year" DropDownList so that I can load the correct values, or how I can send a parameter to the SaveWorkbook Method so that I save only certain cells.

Is it possible to do what I need with this control? Is there an example project I could use to learn more about it or should I use another controller entirely?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 20 Nov 2018, 03:59 PM
Hi Diego,

The custom content provider has a different context, so one of the options is to refer the page context inside the content provider, so you will get access to the controls on the page.

The other option is to create a SpreadSheet document provider inside the custom provider, so you can traverse the sheets (using GetSheets()) and change the desired cells in the SaveWorkbook method of the provider.

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Diego
Top achievements
Rank 1
answered on 20 Nov 2018, 05:20 PM
[quote]Vessy said:Hi Diego,

The custom content provider has a different context, so one of the options is to refer the page context inside the content provider, so you will get access to the controls on the page.

The other option is to create a SpreadSheet document provider inside the custom provider, so you can traverse the sheets (using GetSheets()) and change the desired cells in the SaveWorkbook method of the provider.

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

[/quote]

Hi Vessy, thank you for your answer.

The second option looks very promising, is there any example project or piece of code available that would get me on the right track regarding the implementation of a Spreadsheetdocumentprovider inside the custom provider? I tried looking for more documentation about the custom provider but what I found is very basic (https://docs.telerik.com/devtools/aspnet-ajax/controls/spreadsheet/data-binding/providers/custom-database-provider).

Thank you for your help!

0
Diego
Top achievements
Rank 1
answered on 20 Nov 2018, 09:05 PM
PD: Regarding the first option you have given me, I didn't quite understand how I would go about refering the page context inside the content provider, how would I do that?
Tags
Spreadsheet
Asked by
Diego
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Diego
Top achievements
Rank 1
Share this question
or