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

Export to Excel Without Creating File

3 Answers 335 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Siward Land
Top achievements
Rank 1
Siward Land asked on 27 Sep 2013, 12:23 AM
Hi Forum,

I'm trying to trying to open Excel and populate the worksheet with data without actually saving a *.xlsx a file first from WPF.  When the user clicks on save within Excel, he/she should be prompted with file location selection prompt as no file exists.

The closest example I've found so far is Telerik's xlsxformatprovider, which is not exactly what i'm looking for.
http://www.telerik.com/help/wpf/radspreadsheet-model-import-export-xlsxformatprovider-wpf.html

Does anyone know how to do this?


3 Answers, 1 is accepted

Sort by
0
Anna
Telerik team
answered on 27 Sep 2013, 10:30 AM
Hi,

Thank you for your question. I am not a hundred percent sure at what point of your desired scenario is it that you meet difficulties. Is it the population with data or the save file dialog?

Creating a worksheet without loading it from file first is quite easy through the document model, as you may have already read in the RadSpreadsheet model documentation. You can create a workbook, dynamically add worksheets and modify the cells. All this without loading from any file.

As to the save file dialog, the easiest way fulfill your requirements would be with the SaveFile Command. As you said, since at this stage the content we have so far is not written on any file, the SaveFile command will automatically prompt the user to choose a file location to save the file. Your XAML should look like this:
<Button Text="Save"
      Command="{Binding Path=SaveFile.Command}"
      IsEnabled="{Binding Path=SaveFile.IsEnabled}" />

The data context of the panel can be defined like this:
DataContext="{Binding Path=CommandDescriptors, ElementName=radSpreadsheet}"

The important thing to keep in mind is that before you can save .xlsx files, you need to register the respective format provider in the WorkbookFormatProvidersManager like so:
WorkbookFormatProvidersManager.RegisterFormatProvider(new XlsxFormatProvider());

I hope this answers your question. In case I have misunderstood you or if you need any further clarifications, please, do not hesitate to get back to us.

Also, please keep in mind that while interpreting your question, I assumed that by Excel you mean RadSpreadsheet. If you mean MS Excel you might have to search for answers in a forum with more general orientation such as StackOverflow. 

Regards,
Anna
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
priyanga
Top achievements
Rank 1
answered on 06 Feb 2016, 07:31 AM
i wanna know how to modify the telerik spreadsheet and store in database.
0
Petya
Telerik team
answered on 10 Feb 2016, 04:19 PM
Hello ,

Thanks for your interest in RadSpreadsheet.

I'd recommend going through the following online resources to get started with the control and see how you can achieve the desired task:
RadSpreadsheet Getting Started - lists the required assemblies you need to add to your project to use the control.
RadSpreadsheet FirstLook SDK example - demonstrates how you can integrate RadSpreadsheet with RadRibbonView to achieve an Excel-like look.
Using XlsxFormatProvider - contains examples on how to import a document in the control and export it back to a stream/byte array in order to preserve it in your database.

I hope this is useful. If there is anything else I can help you with, let me know.

Regards,
Petya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Spreadsheet
Asked by
Siward Land
Top achievements
Rank 1
Answers by
Anna
Telerik team
priyanga
Top achievements
Rank 1
Petya
Telerik team
Share this question
or