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
745
Export to PDF is not working after hostong the site.......urgent
posted

Hi to all,

I am using infra volume 2007.3 for my project.. my query is after button clicking am exporting Ultragrid to Excel and PDF... Locally Exporting to Excel and PDF both are working fine.. once i host my application into server PDF function is not working..

I am giving the code details below....

 

 

private void ExportToPDF(object p, FileFormat format)

{

 

// Report

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Infragistics.Documents.Report.

 

Report report = new Infragistics.Documents.Report.Report

();

 

 

 

// Section

Infragistics.Documents.Report.Section.

 

ISection

section = report.AddSection();

section.PageSize = Infragistics.Documents.Report.

 

PageSizes

.Letter;

section.PageMargins.All = 20;

section.PageOrientation =

 

PageOrientation

.Landscape;

section.PageAlignment.Horizontal =

 

Alignment

.Left;

section.PageAlignment.Vertical =

 

Alignment

.Top;

section.PageAlignment =

 

new Infragistics.Documents.Report.ContentAlignment(Alignment.Left, Alignment

.Top);

 

 

 

// Table

Infragistics.Documents.Report.Table.

 

ITable

table = section.AddTable();

 

table.Height =

 

new Infragistics.Documents.Report.FixedHeight

(5000);

table.Width =

 

new Infragistics.Documents.Report.FixedWidth

(800);

table.Margins.Top = 5;

table.Margins.Bottom = 5;

 

 

 

// Header

Infragistics.Documents.Report.Table.

 

ITableHeader

header = table.Header;

header.Height =

 

new Infragistics.Documents.Report.FixedHeight

(25);

header.Repeat =

 

true

;

Infragistics.Documents.Report.Table.

 

ITableCell cell = null

;

 

 

 

Dictionary<string, string> theHeaderDict = new Dictionary<string, string

>();

 

 

//iterate through the column headers and create the table header

 

 

foreach (UltraGridColumn c in this

.uwGrid.Columns)

{

 

 

//Create the header Cells

 

cell = header.AddCell();

cell.Background =

 

new Infragistics.Documents.Report.Background(new Infragistics.Documents.Graphics.Color(Color

.OliveDrab));

cell.Alignment.Vertical = Infragistics.Documents.Report.

 

Alignment

.Middle;

cell.Width =

 

new Infragistics.Documents.Report.FixedWidth

(75);

Infragistics.Documents.Report.Text.

 

IText

text = cell.AddText();

text.Style =

 

new Infragistics.Documents.Report.Text.Style(new Infragistics.Documents.Graphics.Font("Arial", 8, Infragistics.Documents.Graphics.FontStyle.Bold), Infragistics.Documents.Graphics.Brushes

.White);

text.Alignment = Infragistics.Documents.Report.

 

TextAlignment

.Center;

text.AddContent(c.Key);

}

 

Infragistics.Documents.Report.Table.

 

ITableRow row = null

;

 

 

//Iterate through the selected rows and then check each of its cells to see if they are selected:

 

 

foreach (UltraGridRow gr in this

.uwGrid.Rows)

{

row = table.AddRow();

 

 

for (int

i = 0; i < gr.Cells.Count; i++)

{

cell = row.AddCell();

cell.Width =

 

new Infragistics.Documents.Report.FixedWidth

(75);

cell.Alignment.Vertical = Infragistics.Documents.Report.

 

Alignment

.Middle;

cell.Paddings.All = 5;

Infragistics.Documents.Report.Text.

 

IText

text = cell.AddText();

text.Style =

 

new Infragistics.Documents.Report.Text.Style(new Infragistics.Documents.Graphics.Font("Arial", 8), Infragistics.Documents.Graphics.Brushes

.Black);

text.Alignment.Horizontal = Infragistics.Documents.Report.

 

Alignment

.Center;

Am getting below error after hosting my application in the server:

 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   TEBI080_Item_MIn_Base_Qtys_Definer.ExportToPDF(Object p, FileFormat format) +1155
   TEBI080_Item_MIn_Base_Qtys_Definer.btnSaveToDoc_Click(Object sender, EventArgs e) +265
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

 

please anybody suggest the answer......its urgent

Thanks & Regards

Naag C

 

 

 

  • 14049
    Offline posted

    What is TEBI080_Item_MIn_Base_Qtys_Definer?

    Just a quick guess that maybe you don't have anough access rights in the hosted environment?