We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Converting an Excel workbook with angled table headers to an image

I'm attempting to convert an Excel workbook with angled table headers to an image, but the results are not at all what I was expecting. Here's a simple sample:

            var excelEngine = new ExcelEngine();
            var app = excelEngine.Excel;
            app.DefaultVersion = ExcelVersion.Excel2013;
            var workbook = app.Workbooks.Create(1);
            var worksheet = workbook.Worksheets[0];

            for (int c = 1; c < 13; c++)
                var range = worksheet.Range[2, c];
                range.Text = "Test " + c;
                range.CellStyle.Rotation = 45;
                range.CellStyle.Color = Color.ForestGreen;
                range.CellStyle.Font.RGBColor = Color.Black;

                range.BorderAround(ExcelLineStyle.Medium, ExcelKnownColors.Grey_80_percent);

            for (int r = 3; r < 7; r++)
                for (int c = 1; c < 13; c++)
                    var range = worksheet.Range[r, c];
                    range.Text = string.Format("({0},{1})", r, c);
                    range.CellStyle.Color = Color.White;
                    range.CellStyle.Font.RGBColor = Color.Black;

                    range.BorderAround(ExcelLineStyle.Medium, ExcelKnownColors.Grey_25_percent);

            // Save an Excel file.

            // Convert to image and save.
            var image = worksheet.ConvertToImage(1, 1, 15, 15, ImageType.Bitmap, imageStream, System.Drawing.Imaging.EmfType.EmfOnly);
            image.Save("text.png", System.Drawing.Imaging.ImageFormat.Png);

I've attached a zip file with screenshots of the Excel file and the output PNG. The Excel file looks exactly like I want it to, but the converted image looks nothing like the Excel file. The column headers are not angled, and the text that is supposed to be inside those columns appears to be floating above the columns in the row above.

Am I doing something wrong, or are angled columns just not supported by the ConvertToImage method?


Attachment: Screenshots_92add7ae.zip

1 Reply

DB Dilli Babu Nandha Gopal Syncfusion Team May 14, 2015 09:51 AM UTC

Hi Kenneth,

We would like to inform you that we don’t have the support “To provide angled border in worksheet to image conversion” currently and so have logged feature report regarding this, also we were able to reproduce the issue “Improper text position for rotated text in worksheet to image conversion” and have logged defect report regarding this. The support incidents to track the status of this feature and defect has been created under your account. Please log on to our support website to check for further updates.


Please let me know if you have any questions.

Dilli babu.

Live Chat Icon For mobile
Up arrow icon