-1

I maintain an old application in C# who use ExcelWriter version 5. Next year we'll update to 64bits and I was searching about any documentation of this upgrade. I've only searched upgrading from version 6 and they says that older versions are not supported.

Now, with SAXW5NET.DLL I do:

using SoftArtisans.OfficeWriter.ExcelWriter;
using SoftArtisans.ExcelWriter;

SAExcelApplicationDotNet xla = new  SAExcelApplicationDotNet();  ----> ERROR

ExcelTemplate xlt = new ExcelTemplate();
xlt.Open(templatepath);

and then I charge all data in xlt...

xlt.SetCellDataSource(....)

at the end, I process the template

xlt.Process();

and I save it in my object "xla"

xla = xlt.Save();  ---> ERROR

But with the new reference that's wrong...

Any could help me, please?

Thanks in advance.

Hanna

mechanical_meat
  • 163,903
  • 24
  • 228
  • 223
Sonia
  • 11
  • 1

2 Answers2

1

Here are a couple of KB articles that will help answer your questions about using OfficeWriter on 64-bit systems:

64-bit support was added in version 6.9.1 of ExcelWriter (version 3.9.1 or OfficeWriter). However, that only applies to the pure .NET classes. I see from your code that you are using the pure .NET ExcelTemplate object (in the SoftArtisans.OfficeWriter.ExcelWriter namespace), but you are also using the legacy COM interop version of the ExcelApplication object (in the SoftArtisans.ExcelWriter namespace). The COM version of ExcelWriter only has 32-bit support and has been deprecated.

In order to use a newer 64-bit compatible version of ExcelWriter, you will need to make some changes to the parts of your code that use the ExcelApplication object.

There have also been some very minor changes to the API of the ExcelTemplate object in v9 and above (See Upgrading OfficeWriter v8 to v9). For example, instead of the SetCellDataSource() method, you should use BindCellData().

Migrating your code will take a little bit of time but you will have the benefit of using a supported version of the product with all the latest fixes and new functionality, including support for the newer OOXML file formats (.xlsx and .xlsm)

Here is an example of how you might change the code above if you were using the current version of OfficeWriter:

using SoftArtisans.OfficeWriter.ExcelWriter;

ExcelApplication xla = new  ExcelApplication();     
ExcelTemplate xlt = new ExcelTemplate();
// open the template workbook with the ExcelTemplate object
xlt.Open(templatepath);
//set your datasources
xlt.BindCellData(....)
//populate the workbook    
xlt.Process();
//pass the workbook in memory to the ExcelApplication object for post-processing
Workbook wb = xla.Open(xlt);
//manipulate workbook as desired and stream file to client machine
xla.Save(wb, Page.Response, outputfilename, false);
Aviva M.
  • 381
  • 1
  • 9
0

The largest change in the API was from Version 6 to Version 7, but it really wasn't that bad. Overall SoftArtisans is usually pretty good about avoiding API changes.

I suggest you go to their unsupported versions page http://www.officewriter.com/unsupoorted-versions-documentation

and download the old documentation. The included PDF in the zip file has an upgrade guide from version 6 to version 7, which should help you a lot.

I do not think there were changes in the API from 7 to 9 except for added features.

Sam Plus Plus
  • 4,381
  • 2
  • 21
  • 43