Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
480
Document (PDF/XPS) Export is throwing Object Reference..
posted

I am using the following code to export the grid using the DocumentExporter. During the process I am getting an "Object Reference" error. I have already checked things and it is already instantiated in the designer just like the ExcelExporter which is working perfectly fine. Just so I mention it, the grid is being ran as an ActiveX object.  I have also tried embedding the usercontrol in a windows form and facing the same issue.

Sfd = new SaveFileDialog();
Sfd.Filter =
"pdf files (*.pdf)|*.pdf";
if (Sfd.ShowDialog() == DialogResult.OK)
{
this.ugDocumentExporter.Export(this.DataGrid,Sfd.FileName,Infragistics.Win.UltraWinGrid.DocumentExport.GridExportFileFormat.PDF);
OpenProcess =
new System.Diagnostics.Process();
OpenProcess.StartInfo =
new System.Diagnostics.ProcessStartInfo(Sfd.FileName);
}

Stack Trace: 

   at Infragistics.Win.UltraWinGrid.DocumentExport.GraphicsCache.StyleInfo.GetHashCode()
   at System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Infragistics.Win.UltraWinGrid.DocumentExport.GraphicsCache.GetStyle(AppearanceData& appData, Font baseFont, Boolean drawEnabled)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ExportTextToCell(AppearanceData& appData, Font baseFont, UltraGridRow gridRow, UltraGridColumn gridColumn, Alignment& textHAlign, Alignment& textVAlign, CellWrapper reportTextCell, Object exportValue, Size cellSize, TextOrientationInfo textOrientation)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ExportImageAndTextToCell(CellWrapper reportCell, AppearanceData& appData, Image image, Font baseFont, UltraGridRow gridRow, UltraGridColumn gridColumn, Object exportValue, Size cellSize, TextOrientationInfo textOrientation)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ExportImageAndTextToCell(CellWrapper reportCell, AppearanceData& appData, Image image, Font baseFont, UltraGridRow gridRow, UltraGridColumn gridColumn, Object exportValue, Size cellSize)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ExportImageAndTextToCell(IGridCell reportCell, AppearanceData& appData, Image image, Font baseFont, UltraGridRow gridRow, UltraGridColumn gridColumn, Object exportValue, Size cellSize)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ExportNormalCell(UltraGridRow gridRow, UltraGridColumn gridColumn, List`1 reportRows, DocumentColumnInfo documentColumnInfo)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ExportNormalRow(UltraGridRow row, ITable table)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ExportRow(UltraGridRow row, ITable table)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ProcessGridRowInternal(UltraGridExporterHelper ultraGridExporterHelper, UltraGridRow row, ProcessRowParams processRowParams)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridExporterHelper.Infragistics.Win.UltraWinGrid.IUltraGridExporter.ProcessRow(UltraGridRow row, ProcessRowParams processRowParams)
   at Infragistics.Win.UltraWinGrid.RowsCollection.InternalTraverseRowsHelper(IUltraGridExporter exporter)
   at Infragistics.Win.UltraWinGrid.UltraGrid.Export(IUltraGridExporter exporter)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.Export(UltraGrid grid, ISection section)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.Export(UltraGrid grid, Report report)
   at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.Export(UltraGrid grid, String fileName, GridExportFileFormat fileFormat)
   at InterAmerica.CapCorr.WinApp.Components.EventMediator.ExecuteCommand(String command)