Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.8.1
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > ExcelTemplate > Process

Process Method

C# Syntax:

public void ExcelTemplate.Process();

VB.NET Syntax:

Public Sub ExcelTemplate.Process()

Description:

The Process method enters data source values in a template's data markers, and creates the output file (the new spreadsheet) in memory. The Save method can then save the output file to disk, stream it to the browser, or both.

Call Process after SetDataSource and before Save.

You can call Process more than once for a single instance of ExcelTemplate. This allows you to generate multiple files from a single template and an updated data source.

It is Process - not Open - that actually opens the template file. Open just verifies that the file name is valid and remembers the name. For this reason, certain file errors may be detected later, when Process is called.

Exceptions:

Example:

[C#]
...
ExcelTemplate xlt = new ExcelTemplate();
xlt.Open(Application["templatepath"] +
	@"\DataBinding\ArrayBindingTemplate2.xls");

//--- Set a data source for the data marker "SimpleArray."
string[] onedim = {"SoftArtisans", "OfficeWriter", "ExcelTemplate"};
xlt.SetColumnDataSource(onedim, "SimpleArray");

//--- Process the template to populate it with the data source data.
xlt.Process();
							
//--- Stream the processed document to the client.
xlt.Save(Page.Response, "ArrayBinding.xls", false);
...



Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.