Table of Contents |
---|
|
Setting Up the Templates
Getting Started
In this tutorial ExcelApplication is being used to join two Worksheets into one Workbook. These two worksheets were created in Part 1 and Part 2 of this tutorial.
Adding an ExcelWriter Reference in Visual Studio
Create a .NET project and add a reference to the ExcelWriter library.
- Open Visual Studio and create a .NET project.
- The sample code uses a web application.
- Add a reference to SoftArtisans.OfficeWriter.ExcelWriter.dll
- SoftArtisans.OfficeWriter.ExcelWriter.dll is located under Program Files > SoftArtisans > OfficeWriter > dotnet > bin
Writing the Code
1. Include the SoftArtisans.OfficeWriter.ExcelWriter namespace in the code behind
2. In the method that will run the report, instantiate the ExcelTemplate object.
3. Open the template file with the ExcelTemplate.Open
method.
4. Create a DataBindingProperties
object. None of the binding properties will be changed for this tutorial, but DataBindingProperties
is a required parameter in ExcelTemplate
data binding methods.
Data Binding
1.Get the data for the Assets, Losses, and Other datasets
These calls are to a helper method GetCSVData
that parses the CSV files and returns a DataTable
with the values.
If you are following in your own project and would like to parse the CSV files as well, you will need to:
- Add a reference to
GenericParsing.dll
- Include
GeneringParsing
at the top of your code. - Add the
GetCSVData
method that can be found in the sample code.
2. Use ExcelTemplate.BindData
to bind the data for the Top and Details Sales data sets.
3. Call ExcelTemplate.Process() to import all data into the file.
4. Call ExcelTemplate.Save() to save the final file.
Final Code
Downloads
TBA