0

I am using telerik rad grid. I want to export the grid with html header.

I want to manually add the header html. For that i am reading the html file and then assigning it to raw html as below.

This id the final html that is getting generated by after reading the file.

<div style='width:500px;float:left;'>
<div style='width:250px;float:left;'>
    <div>
        Customer : sachin
    </div>
    <div>
        Machine  : New Machine
    </div>
    <div>
        Build    : R956
    </div>
</div>
<div style='width:250px;float:left;'>
    <div>
        Date     : 11/7/2014 5:15:05 AM
    </div>
</div>

and here is how i am assigning it. The caption variable contains html shown above.

 protected void radPreview_PdfExporting(object sender, GridPdfExportingArgs e)
    {
        e.RawHTML = Caption + e.RawHTML;
    }
System.InvalidCastException: Unable to cast object of type 'Telerik.Web.Apoc.Layout.BlockArea' to type

'Telerik.Web.Apoc.Layout.AreaContainer'. at Telerik.Web.Apoc.Fo.Flow.BlockContainer.Layout(Area area) at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area) at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region) at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area) at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree) at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement() at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)

I tried to search a lot on this issue. please suggest me the solution that works.

1 Answer 1

0

After searching a lot on this issue i found the issue from one old telerik thread.

PDF export will not handle two scenarios.

1) Div tag with fixed width or height. ( this was the issue in my case )

2 ) Div tags with absolute position.

Hope this will help someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.