This is a migrated thread and some comments may be shown as answers.

Problem with saving the Exported pdf file on the server.

0 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SivaPrasad Bevara
Top achievements
Rank 1
SivaPrasad Bevara asked on 25 May 2011, 03:19 PM
Hi,

I need to send Gird rows in an email.

So I have choosen exporing the grid content to a PDF file and sending it as an attachement.

To send it as an attachement I want to save the file on the server.

Following is the code which I am using to create file on the server.
    RadDocument document = CreateDocument(customerGridView);
  
document.LayoutMode = DocumentLayoutMode.Paged;
  
document.Measure(RadDocument.MAX_DOCUMENT_SIZE);
document.Arrange(new RectangleF(PointF.Empty, document.DesiredSize));
  
PdfFormatProvider provider = new PdfFormatProvider();
  
using (dynamic fso = AutomationFactory.CreateObject("Scripting.FileSystemObject"))
{
    string path = "C:\\Shiva\\App_Data\\Reports\\Tran.pdf";
   dynamic file = fso.CreateTextFile(path, true);
  
    using (Stream output = file)
    {
        provider.Export(document, output);
    }
    file.Close();
}

With the above code I am able to create a pdf file on the server, but facing problem while exporting data (Stream) in the file.

Please help.

FYI: I am using OOB application.

Regards,
SivaPrasad.B

No answers yet. Maybe you can help?

Tags
GridView
Asked by
SivaPrasad Bevara
Top achievements
Rank 1
Share this question
or