Home     Products      Support      Corporate     Sign In 

Support Knowledge Base, Article 1225

Product
OfficeWriter
Title
Corrupt spreadsheet when calling SetConditionalFormat() with .NET 2.0
Problem

In ExcelWriter versions prior to 6.6.1, setting conditional formatting with the API does not work properly with .NET 2.0. The functionality works correctly with .NET 1.1 and 1.0. If your virtual application is set to run on .NET 2.0, calling the SetConditionalFormat() method will generate a corrupt file which can not be opened in Excel.

Here is an example of code which can cause Microsoft Excel to fail:

ExcelApplication xla = new ExcelApplication();

Workbook wb = xla.Create();

Worksheet ws = wb.Worksheets.CreateWorksheet("SampleSheet");

/* we create the area to which our sample conditional format
   will apply */

Area sampleArea = ws.CreateArea(1,1,0,0);

ConditionalFormat sampleFormat = wb.CreateConditionalFormat();

Condition sampleCondition = sampleFormat.
CreateCondition(Condition.Comparison.CellValueLessThan,”100”); 
                
sampleArea.SetConditionalFormat(sampleFormat);

After running this code, Microsoft Excel is not able to open the output file and may generate the following error:

Solution
The problem was fixed in version 6.6.1 of ExcelWriter. Therefore, we have two options to solve it:
  • If possible, upgrade to ExcelWriter version 6.6.1,which is included in OfficeWriter version 3.6.1
  • If not, change your ExcelWriter application virtual directory configuration to run on .NET 1.1
To change the virtual directory configuration settings:
  1. Open your IIS,right-click on the corresponding ExcelWriter application virtual directory and select "Properties"
  2. Click on "Configuration" to get to the Application Mappings panel
  3. Select the ".aspx" extension and click on "Edit"
  4. Click on "Browse" and go to "v1.1.4322" folder under the "Framework" sub-directory
  5. Select the "aspnet_isapi.dll" file and then click OK
Now your ExcelWriter application should run properly.
Related Links
OfficeWriter Home Page
Purchase OfficeWriter
OfficeWriter Enterprise Edition
OfficeWriter: Programmatic Runtime Control

Created : 11/2/2006 12:58:42 PM (last modified : 2/26/2007 4:39:41 PM)

Rate this article!

 
Comments



Copyright 2006 © SoftArtisans, Inc. All Rights Reserved.

Site Map     |     Privacy Policy     |     Contact Us