Message-ID: <485569425.10033.1711710244729.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_10032_714919770.1711710244729" ------=_Part_10032_714919770.1711710244729 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Adding OfficeWriter to your .NET Application

Adding OfficeWriter to your .NET Application

Makin= g OfficeWriter available to your applications

There are several steps to make OfficeWriter available to your .NET appl= ications:

  1. Install OfficeWriter
  2. Include = System.Web
  3. Add refe= rences to OfficeWriter
  4. Include Of= ficeWriter in your code

Add a reference to System.Web

All of the OfficeWriter API objects (ExcelTemplate, ExcelAppli= cation, PowerPointTemplat= ePowerPointAppl= ication,  WordTemplate<= /a>, WordApplication) have the= output options for saving to disk, saving to memory stream, streaming to u= ser in a page response. The last output option, streaming to the user, has = a dependency on System.Web. If you are developing a web applic= ation, the reference to System.Web should have been added auto= matically. For other types of applications, you may need to add this refere= nce.

If you are using Visual Studio .NET:

  1. Right-click the project name in the Solution Explorer and choose Add Re= ference.
  2. Click System and locate System.Web
=20
=20 Icon=20
=20

If you are compiling against .NET 4.0, make sure to use the full profile= . The default profile does not include System.Web.

=20
=20
=20

Add a reference to OfficeWriter

There are two ways to do this:

Method #1: Adding OfficeWriter to a specific appl= ication

  1. At the top level of your application, create a directory call b= in.
  2. Copy SoftArtisans.OfficeWriter.ExcelWriter.dll, SoftArtisans.OfficeWrit= er.PowerPointWriter.dll, or SoftArtisans.OfficeWriter.WordWriter.dll from t= he install directory to your application's bin directory.

If you are using Visual Studio .NET:

  1. Right-click the project name in the Solution Explorer and choose Add Re= ference.
  2. Click Browse and navigate to C:\Program Files\SoftArtisans\OfficeWriter= \bin.
  3. Choose Softartisans.OfficeWriter.ExcelWriter.dll,  SoftArtisans.Of= ficeWriter.PowerPointWriter.dll, or SoftArtisans.OfficeWriter.WordWrit= er.dll and click Open.
  4. Click OK.

Method #2: Making OfficeWriter avai= lable to all applications on a machine

Step 1: Install OfficeWriter in the Global A= ssembly Cache (GAC)

These instructions can be used for installing SoftArtisans.OfficeWriter.= ExcelWriter.dll, SoftArtisans.OfficeWriter.PowerPointWriter.dll or SoftArti= sans.OfficeWriter.WordWriter.dll in the GAC; remember to change 'ExcelWrite= r' to 'WordWriter' or 'PowerPointWriter depending on the dll you wish to in= stall:

  1. Open a command prompt window and move to the directory OfficeWriter\bin= \dotnet20\.
  2. Enter gacutil /i SoftArtisans.OfficeWriter.ExcelWriter.dll.
  3. Open the file machine.config (in [Windows directory]\M= icrosoft.NET\Framework[.NET version directory]\CONFIG).
Step 2: Reference the copy= of OfficeWriter in the GAC in machine.config or web.config

Add the following line to the assemblies node of machin= e.config:

=20
<add assembly=3D"Softartisans.OfficeWriter.ExcelWriter,
            Version=3Dx.x.x.x, Culture=3Dneutral, PublicKeyToken=3Df593502a=
f6ee46ae"/>
=20
=20
= =20
=20

You may need to add the assemblies parent node to machi= ne.config under the configuration node.

=20
=20
=20

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= .

=20
<?xml version=3D"1.0" encoding=3D"utf-8" ?&g=
t;
<configuration>
    <system.web>
        <compilation>
            <compilers>
            </compilers>
            <assemblies>
                <add assembly=3D"Softartisans.OfficeWriter.ExcelWri=
ter,
                    Version=3Dx.x.x.x,
                    Culture=3Dneutral,
                    PublicKeyToken=3Df593502af6ee46ae"/>
                <add assembly=3D"*" />
            </assemblies>
        </compilation>
    </system.web>
</configuration>
=20
=20
= =20
=20

The version attribute of the add assembly node must correspond e= xactly to the version of Softartisans.OfficeWriter.<Excel/Word&= gt;Writer.dll added to the GAC. If you add a new version of Softartisans.Of= ficeWriter.<Excel/Word>Writer.dll to the GAC using the gacutil comman= d, update the dll version attributes in machine.config. To get the exact ve= rsion of Softartisans.OfficeWriter.<Excel/Word>Writer.dll, right-clic= k the file and select the Properties tab.

=20
=20
=20

Include OfficeWriter in your code

On any page that uses OfficeWriter, make sure to add the appropriate using statements:

=20
using SoftArtisans.OfficeWriter.ExcelWriter; //For ExcelWriter
using SoftArtisans.OfficeWriter.WordWriter; //For WordWriter

using SoftArtisans.OfficeWriter.PowerPointWriter; //For PowerPointWriter=20

As mentioned above, you will also need to make sure that System.We= b is included in your project.

------=_Part_10032_714919770.1711710244729--