Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Excel sheet as a template vs. a "real" Excel template in OpenXML

Does anyone have any good answer what kind of difference there is between

  • using some arbitrary pre-formatted Excel 2007 *.xlsx file as a template, loading it in my C# app, and filling up some of its cells with data using the Microsoft OpenXML SDK

versus

  • creating specific Excel templates (*.xltx) files and using those as basis for my "data filling" exercise

Do I loose something when I don't use the Excel templates (*.xltx)?

If so - what do I loose?

like image 916
marc_s Avatar asked Apr 23 '10 20:04

marc_s


1 Answers

No, you don't lose anything at all. An XLTX is the same as an XLSX in all respects - it's just that Excel creates a new instance of an XLSX if the file opened is an XLTX. That's all. If you use an XLTX for your data filling and save out an XLSX, every new instance (XLSX) will have that data when the resulting XLSX is opened.

The other question is whether or not you need to use an XLTX at all if you are doing your data-filling from OOXML - I don't see any reason why you would need to use an XLTX at all as long as your pre-formatted XLSX is saved with a different file name, your XLSX should be fine as a template. An XLTX is really meant for Excel client app operation - programmatic solutions such as OOXML offer no benefits in using a different file extension (not true of VSTO however, which is also an Excel client app operation).

like image 64
Todd Main Avatar answered Oct 09 '22 03:10

Todd Main