There are several steps to make OfficeWriter available to your .NET applications:
All of the OfficeWriter API objects (ExcelTemplate, ExcelApplication, PowerPointTemplate, PowerPointApplication, WordTemplate, WordApplication) have the output options for saving to disk, saving to memory stream, streaming to user in a page response. The last output option, streaming to the user, has a dependency on System.Web
. If you are developing a web application, the reference to System.Web
should have been added automatically. For other types of applications, you may need to add this reference.
If you are using Visual Studio .NET:
If you are compiling against .NET 4.0, make sure to use the full profile. The default profile does not include |
There are two ways to do this:
If you are using Visual Studio .NET:
These instructions can be used for installing SoftArtisans.OfficeWriter.ExcelWriter.dll, SoftArtisans.OfficeWriter.PowerPointWriter.dll or SoftArtisans.OfficeWriter.WordWriter.dll in the GAC; remember to change 'ExcelWriter' to 'WordWriter' if you want to install SoftArtisans.OfficeWriter.WordWriter.dll instead of ExcelWriter:
Add the following line to the assemblies node of machine.config:
<add assembly="Softartisans.OfficeWriter.ExcelWriter, Version=x.x.x.x, Culture=neutral, PublicKeyToken=f593502af6ee46ae"/> |
You may need to add the assemblies parent node to machine.config under the configuration node. |
OR
Create a text file containing the following lines, and save it as web.config. Save web.config at the top level of your application.
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation> <compilers> </compilers> <assemblies> <add assembly="Softartisans.OfficeWriter.ExcelWriter, Version=x.x.x.x, Culture=neutral, PublicKeyToken=f593502af6ee46ae"/> <add assembly="*" /> </assemblies> </compilation> </system.web> </configuration> |
The version attribute of the add assembly node must correspond exactly to the version of Softartisans.OfficeWriter.<Excel/Word>Writer.dll added to the GAC. If you add a new version of Softartisans.OfficeWriter.<Excel/Word>Writer.dll to the GAC using the gacutil command, update the dll version attributes in machine.config. To get the exact version of Softartisans.OfficeWriter.<Excel/Word>Writer.dll, right-click the file and select the Properties tab. |
On any page that uses OfficeWriter, make sure to add the appropriate using
statements:
using SoftArtisans.OfficeWriter.ExcelWriter; //For ExcelWriter using SoftArtisans.OfficeWriter.WordWriter; //For WordWriter using SoftArtisans.OfficeWriter.PowerPointWriter; //For PowerPointWriter |
As mentioned above, you will also need to make sure that System.Web
is included in your project.