In this thread a user asked if it was possible to export to an Excel template. The answer provided indicated to use the overload for the UltraGridExcelExporter.Export() method that allowed you to specify the WorkbookFormat. The API documentation isn't all that clear, but I surmise that these are pre-defined "templates". I'm actually wanting to know if it's possible to use a .xlt file as the format for the exported Excel file. For example, to have a certain Page Setup configured with custom headers and footers for the Excel file. If I am mistaken, please correct me, but based on what I see in the API documentation, there does not seem to be a way to do this (directly) with the UltraGridExcelExporter class. Is there a possibility to use a user-created template file when exporting to Excel?
Currently my planned workaround is to export as usual, then using ActiveX create a new workbook based on the template, and copy -> paste from the exported workbook to the "templated" workbook. Then I'd need to copy the color palette since the export also changes the color palette for Excel.
The WorkbookFormat enumeration has various values indicating the file format for the saved workbook. One of these values is Excel97To2003Template, which is associated with an .xlt file. If you use that value and save to a file path with an .xlt extension, the exporter will create the template file.
Thanks for response. But I believe you misunderstood my question. I don't want it to create the template file. The template file already exists. I want to use a template file as a starting point.
Oh, in that case, I believe there is an overload of the Export method which takes a Workbook or Worksheet instance. You can manually load your template file using the static Workbook.Load method, pass the returned instance (or a Worksheet from the returned instance) to the Export method, and then save back to the file using the instance Workbook.Save method.
Sorry for the delayed response. Got pulled onto a "this is an emergency, the whole world is waiting with baited breath for this, blah, blah, blah" task.
In any event, I completely missed that static function while delving into the documentation. Thanks for the clarification.