"Could not load any Template "

Dec 4, 2009 at 12:16 PM

 Hi,

I am getting error.

"Could not load Template Excel2007.st"

 

<font size="2">

 

</font>

SaveFileDialog dialogSaveFile = new SaveFileDialog();<font size="2">

dialogSaveFile.Filter =

</font>

"Excel 2007[*.xlsx]|*.xlsx|Excel 2003[*.xls]|*.xls";

 bool? b = dialogSaveFile.ShowDialog();

if (b == true)
            {
                string filename = dialogSaveFile.FileName;


                DataTable dta = new DataTable("andrei");
                dta.Columns.Add(new DataColumn("ID", typeof(int)));
                dta.Columns.Add(new DataColumn("Data", typeof(string)));
                dta.Rows.Add(1, "test 1 & <");
                dta.Rows.Add(2, "test 2 ");
                dta.Rows.Add(3, "test 3 >");

                dta.ExportTo(ExportToFormat.Excel2007, filename);

             }

Can you point out the error and what can I do?

Thanks in advance

<font size="2">

wind

</font>

 

 

Coordinator
Dec 4, 2009 at 2:01 PM

maybe instead of

 

Excel 2007[*.xlsx]|*.xlsx|Excel 2003[*.xls]|*.xls

you shoud use

Template files(*.st)*.st

 

The exporter transforms from a .st file, not an xls file

In order to make an .st file from a .xlsx file, please look the example