Making OfficeWriter available to your applications

Once you've installed OfficeWriter, the next step is to make OfficeWriter available to your .NET applications. There are two approaches:

Method #1: Adding OfficeWriter to a specific application

  1. At the top level of your application, create a directory call bin.
  2. Copy SoftArtisans.OfficeWriter.ExcelWriter.dll or SoftArtisans.OfficeWriter.WordWriter.dll from the 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 Reference.
  2. Click Browse and navigate to C:\Program Files\SoftArtisans\OfficeWriter\bin.
  3. Choose Softartisans.OfficeWriter.ExcelWriter.dll or SoftArtisans.OfficeWriter.WordWriter.dll and click Open.
  4. Click OK.

Method #2: Making OfficeWriter available to all applications on a machine

Step 1: Install OfficeWriter in the Global Assembly Cache (GAC)

These instructions can be used for installing SoftArtisans.OfficeWriter.ExcelWriter.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:

  1. Open a command prompt window and move to the directory OfficeWriter\bin\dotnet20\.
    # Enter gacutil /i SoftArtisans.OfficeWriter.ExcelWriter.dll.
    # Open the file machine.config (in [Windows directory]\Microsoft.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 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.