I'm just trying to right align a cell in the exported PDF using the WebHierarchicalDataGrid and WebDocumentExporter - 13.1.20131.2107
Here's my column:
<ig:BoundDataField Key="Hours" DataFormatString="{0:###,##0.0}" Width="4%" DataType="System.Decimal" CssClass="numCol"> <Header Text="Hours" CssClass="right"></Header> </ig:BoundDataField>
The numCol class just sets the text-align to right. It works fine in the browser.
.numCol {text-align: right !important;white-space: nowrap; }
I even went so far as to try to set the report's cell alignment in all the events but they don't take.
void docExporter_GridRecordItemExported(object sender, DocumentGridRecordItemExportedEventArgs e) { string css = e.GridCell.Column.CssClass.ToLower(); if (css.Contains("numcol")) { e.CellElement.Alignment.Horizontal = Alignment.Right; } }
Any ideas? Thanks!
Hello,
I will be happy to assist you with your question.
After briefly looking over your code, I see that you are using the GridRecordItemExported event which fires after a GridRecordItem has finished exporting. If this is the case, setting the Alignment for the CellElement in this event would be to late. I recommend using the GridRecordItemExporting event for the WebDocumentExporter to get the behavior you are requesting.
To learn more about the GridRecordItemExporting event, please visit our online help documentation using the link below:http://help.infragistics.com/NetAdvantage/ASPNET/2013.1/CLR4.0/?page=Infragistics4.Web.v13.1~Infragistics.Web.UI.GridControls.WebDocumentExporter~GridRecordItemExporting_EV.html
Please let me know if you have any questions regarding this matter.
I've tried all of the events and I can't get it to right align. I've tried applying the alignment to the cells too. I've attached a simple project. Can you try it out?