Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Description

Excerpt

Opens an ExcelWriter template spreadsheet. A template is a file created in Microsoft Excel that contains data markers where data source values will be inserted.

Signature
C#C#
Wiki Markup
{description}
{excerpt}Opens an ExcelWriter template spreadsheet. A template is a file created in Microsoft Excel that contains data markers where data source values will be inserted.
{excerpt}
{signature:C#}
 public virtual void Open(System.String fileName)
Signature
{signature}
{signature:vb.net
vb.net
}
Public Overridable Sub Open(ByVal fileName As String)
Parameters

...

The complete path and file name of the template Excel file.

Exceptions

...

Open will throw this exception if null (C#) or Nothing (VB.NET) is passed to the method.

...

Remarks

If your template file is the new Office Open XML (.xlsx) format, you can pass it into the Open method just as you would a BIFF8 (.xls) Excel file. You will need to remember to give the output file a ".xlsx" extension when you call Save, as ExcelWriter cannot convert .xlsx files to .xls.

{signature}
{parameters}
{param:templateFileName}The complete path and file name of the template Excel file.
{param}
{exceptions}
{exception:ArgumentNullException}[Open|ExcelTemplate.Open] will throw this exception if {{null}} \(C\#\) or {{Nothing}} \(VB.NET\) is passed to the method.
{exception}
{exception:ArgumentException}
{exception}
{remarks}If your template file is the new Office Open XML \(.xlsx\) format, you can pass it into the [Open|ExcelTemplate.Open] method just as you would a BIFF8 \(.xls\) Excel file. You will need to remember to give the output file a ".xlsx" extension when you call [Save|ExcelTemplate.Save], as ExcelWriter cannot convert .xlsx files to .xls. 
{remarks}
{example}{code:csharp|title=C#}

          //--- Open an Excel BIFF8 (.xls) file
          oExcelTemplate.Open(Application["templatepath"] +
               @"\DataBinding\EmployeeOrdersTemplate.xls");
   
          //--- Open an Office Open XML Excel (.xlsx) file
          oExcelTemplate.Open(Application["templatepath"] +
               @"\DataBinding\EmployeeOrdersTemplate.xlsx");
        
{code}
{code:vb.net
|title=vb.net
}

          '--- Open an Excel BIFF8 (.xls) file
          oExcelTemplate.Open(Application("templatepath") & _
               "\DataBinding\EmployeeOrdersTemplate.xls")
       
          '--- Open an Office Open XML Excel (.xlsx) file
          oExcelTemplate.Open(Application("templatepath") & _
               "\DataBinding\EmployeeOrdersTemplate.xlsx")
        {code}

{example}
Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle