I am using the Infragistics.Win.UltraWinGrid.DocumentExport.Utilities.BuildFormattedText method to create a pdf of the contents of an UltraFormattedTextEditor. However, the end result is always left-aligned.
Looking at the comments it says Text Alignment is "...not possible without providing an element into which multiple IText elements can be added...".
The element it is referring to is an IGridCell.
Does anyone have an idea how the overloaded method could be used with a UTFE?
Thanks in advance.
The alignment in the UFTE needs to be setup the way that you want it, but the comment in the /// is that it cannot build a generic string that will respect the alignment in the Documents engine, so you need to export the UltraFormattedTextEditor into an IGrid instance's cell. This method was originally written for the UltraGridDocumentExporter, so if you need it to handle alignment in other types of elements, you should submit a feature request.
-Matt
Thanks Matt.
In case anyone is interested, I got it to work using the following code. (txtText is a UTFE.)
var report = new Infragistics.Documents.Report.Report();var section = report.AddSection();section.PageMargins.All = 75;var grid = section.AddGrid();var column = grid.AddColumn();var row = grid.AddRow();var cell = row.AddCell();var appearance = new AppearanceData();appearance.ForeColor = Color.Black;Infragistics.Win.UltraWinGrid.DocumentExport.Utilities.BuildFormattedText(txtText.Value.ToString(), txtText.Size, Font, ref appearance, ref cell);report.Publish(saveFileDialog1.FileName, Infragistics.Documents.Report.FileFormat.PDF);