You can use the Excel Import and Export Component to import and export Excel files into the SpreadJS widget. The component resides on your application server. This example shows how to use the Excel Import and Export component in a Visual Studio 2015 Windows Forms application. Use the following steps to create the sample:
- Install the product (run SpreadJS ExcelIO Server Component.exe or check the Excel IO Server Component in the web installer). The program files are installed to “C:\Program Files (x86)\GrapeCity\Spread Studio 9\SpreadJS\ExcelIO”.
Installed Files
- Create a Windows Forms application in Visual Studio.
- Add the ExcelIO assembly references from the setup folder.
References
- Add two Button controls, a RichTextBox control, an OpenFileDialog component, and a SaveFileDialog component. Set the name and text for each control.
- Use the following steps to create a run time license file, add the license information to the file, and then add the file as an Embedded Resource in the Properties folder (or the project folder in a VB project).
- Open notepad.exe and add "GrapeCity.Spread.Sheets.ExcelIO.Spread, GrapeCity.Spread.Sheets.ExcelIO, Version=9.40.20153.0, Culture=neutral, PublicKeyToken=3ef656c0a61aba3a" to the file.
- Use Save As to save the file.
- Rename the file to "licenses.licx".
- Copy the file to the main project folder for a VB project and add the file as a resource. Set the Build Action to Embedded Resource to include the file as an embedded resource.
Add Resource File to Project
- Copy the file to the Properties folder for a C# project and include it as an Embedded Resource in the Properties folder.
Change Build Action
Add import and export logic in the two button click events. For example: C#
VB
Build and Press F5 to run. Select the Import Excel button to import an Excel-formatted file.
- Select the Export Excel button to export the JSON string to an Excel file.