We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Axis lables rendered incorrectly if worksheet is rendered as image

We are using Aspose.Cells . NET 20.4.0 to render Excel worksheets to images.

For some charts, the x-axis labels are in wrong place. See the attached files. It’s the x-axis of “Test 2” chart.

We’ve used the following code.

    public void AxisLegend()
    {
        var path = @"Output\axis-label-rendering.xlsm";
        using (var sourceStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
        {
            var xls = new Workbook(sourceStream);

            try
            {
                var printerOptions = new ImageOrPrintOptions
                {
                    OnePagePerSheet = true,
                    IsCellAutoFit = true,
                    TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
                    HorizontalResolution = 300,
                    VerticalResolution = 300,
                    ImageType = ImageType.Jpeg
                };

                var visibleWorkSheets = xls.Worksheets.Where(ws => ws.IsVisible).ToList();
                for (var i = 0; i < visibleWorkSheets.Count; i++)
                {
                    var renderer = new SheetRender(visibleWorkSheets[i], printerOptions);

                    // if no page to render
                    if (renderer.PageCount <= 0) continue;

                    using (var bmp = renderer.ToImage(0))
                    {
                        bmp?.Save($"{path}_sheet{i}.jpg");
                    }
                }
            }
            catch 
            {
                //
            }
        }
    }

axis-label-rendering.zip (29.5 KB)
axis-label-rendering.xlsm_sheet0.png (94.4 KB)

@bitterlich,

Thanks for the template file, sample code segment and screenshot.

After an initial test, I am able to reproduce the issue as you mentioned by using your sample code with your template file. I found axis labels for Test 2 chart are rendered incorrectly in the output image. I have logged a ticket with an id “CELLSNET-47364” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@bitterlich,

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

The issues you have found earlier (filed as CELLSNET-47364) have been fixed in Aspose.Cells for .NET v20.6. you may also get the version @ NuGet repos. here (https://www.nuget.org/packages/Aspose.Cells/20.6.0).This message was posted using Bugs notification tool by Amjad_Sahi

The issues you have found earlier (filed as CELLSNET-47364) have been fixed in Aspose.Cells for .NET v20.6. you may also get the version @ NuGet repos. here (https://www.nuget.org/packages/Aspose.Cells/20.6.0).This message was posted using Bugs notification tool by Amjad_Sahi