Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 1283
Product
ExcelWriter
Version
6.9.2
Title
Chart height incorrect or chart missing when creating charts programmatically with ExcelWriter 6.9.2
Problem

In version 6.9.2, an issue was introduced regarding the height property of the chart object. When using ExcelApplication to create a new chart on a spreadsheet, a chart with unchangeable height will be created, sometimes having its value set to a negative number causing it to disappear altogether.

The height assigned to the chart by default will depend on the location of the chart and re-assigning the height will have no affect. Setting the location (anchor) of a chart to row 2 or lower in the worksheet will set a negative height value. This will cause the chart to become invisible. A chart with Anchor set to a row above 2 will be visible, but will have a seemingly random and unchangeable height. Creating the chart and then changing it's location using the Position property will not solve the problem.

Note: this problem occurs only with charts created programmatically on a worksheet.

Solution

SoftArtisans is working to resolve this issue as quickly as possible. The number of the version in which this bug is fixed will be added to this article.

In the meantime, there are three workarounds:

  • Use an input file that contains a chart, then modify it using ExcelApplication. Since this bug only affects charts created programmatically, charts that already exist in an input file will work properly.

    The following code will get a handle on the first existing chart using the worksheet Charts collection:
    
    [C#]
    Chart crt = ws.Charts[0];
    
    [VB.NET]
    Dim crt As Chart
    crt = ws.Charts(0)
    
    

  • Create the chart on a ChartSheet instead of on a WorkSheet:
    
    [C#]
     Chartsheet cs = wb.Worksheets.CreateChartsheet(ChartType.Column.Clustered, 
                                                              "ChartSheet");
    [VB.NET]
     Chartsheet cs = wb.Worksheets.CreateChartsheet(ChartType.Column.Clustered, 
                                                              "ChartSheet")
    
    

  • Downgrade to version 6.9.1

We apologize to our users for the inconvenience.
Created : 10/20/2008 1:04:49 PM (last modified : 10/24/2008 2:01:45 PM)
Rate this article!
Comments