Problem using HTML formatting in a PDFGrid cell

Hi
I'm trying to do modest HTML formatting on a PDF Grid. But I have a problem. My code works ok on my dev machine, but when I upload it to Azure, it throws exception "A generic error occurred in GDI+."
The source of the problem is this line

if (tmp.Contains("")) grid.Rows[i].Cells[j].IsHtmlText = true;

If I comment it out on Azure server, report works, if left uncommented, report fails.

My printing code is this:

private float DrawGrid(float bottom)

{

for (int i = 0; i < grid.Rows.Count; i++)

{

for (int j = 0; j < grid.Rows[i].Cells.Count; j++)

{

string tmp = grid.Rows[i].Cells[j].Value.ToString();

if (tmp.Contains("")) grid.Rows[i].Cells[j].IsHtmlText = true;

}

}

PdfGridLayoutFormat layoutFormat = new PdfGridLayoutFormat();

layoutFormat.Layout = PdfLayoutType.Paginate;

layoutFormat.Break = PdfLayoutBreakType.FitPage;

PdfGridLayoutResult gridResult = grid.Draw(

page,

new RectangleF(new PointF(0, bottom + 40),

new SizeF(page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height - 100)),

layoutFormat

);

bottom = gridResult.Bounds.Top + gridResult.Bounds.Size.Height;

return bottom;

}

PdfGrid is has a DataGrid as its data source. Some strings get some HTML formatting when loaded to datagrid:


if (!string.IsNullOrEmpty(workNumber))

{

itemNameString = string.Format("{0}\n{1}: {2}", partNumber, TO.Resources.PrintoutStrings.WorkNumber, workNumber);

if (!string.IsNullOrEmpty(desc))

{

itemNameString = string.Format("{0}\n{1}", desc.Trim());

}

}

else

{

itemNameString = string.Format("{0}", partNumber);

if (!string.IsNullOrEmpty(desc))

{

itemNameString = string.Format("{0}\n{1}", itemNameString, desc.Trim());

}

}


What can I do to fix this problem?

Stack dump is enclosed.

All the best
Olavi


Attachment: sfsd_f820e7bc.7z

1 Reply

CM Chinnu Muniyappan Syncfusion Team November 14, 2017 09:42 AM UTC

Hi Olavi, 
 
Thank you for contacting Syncfusion support. 
 
Currently, we do not have support for rendering HTML formatted text in windows azure platform due to GDI restrictions in Windows azure. Internally we are using GDI functionalities for processing the HTML formatted text to drawn it to a PDF document. We have logged a feature request for “Need to add support for rendering HTML formatted text in PDF document in Windows Azure”, will be implemented in one of our releases. The feature implementation greatly depends on product design, code compatibility and complexity. We request you to visit our website periodically for feature updates. 
 
Regards,  
Chinnu  


Loader.
Up arrow icon