Telerik.WinControls.Export.PdfExportRenderer renderer = new Telerik.WinControls.Export.PdfExportRenderer(); Unknow Type

16 posts, 0 answers
  1. Gustavo
    Gustavo avatar
    3 posts
    Member since:
    Aug 2016

    Posted 31 Aug 2016 Link to this post

    Hello Telerik,

    I want to export a file.txt  to Pdf, I´m using GridViewPdfExport component but this line does not work:

    Telerik.WinControls.Export.PdfExportRenderer renderer = new Telerik.WinControls.Export.PdfExportRenderer();

     

    This is my code , taken from Export to PDF

     

    Telerik.WinControls.Export.GridViewPdfExport pdfExporter = new Telerik.WinControls.Export.GridViewPdfExport(radGrid1);
    pdfExporter.FileExtension = ".pdf";
    pdfExporter.ShowHeaderAndFooter = true;
    pdfExporter.HeaderHeight = 30;
    pdfExporter.HeaderFont = new Font("Arial", 22);
    pdfExporter.Logo = System.Drawing.Image.FromFile(@"C:\temp\logo.png");
    pdfExporter.LeftHeader = "[Logo]";
    pdfExporter.LogoAlignment = ContentAlignment.MiddleLeft;
    pdfExporter.LogoLayout = Telerik.WinControls.Export.LogoLayout.Fit;
     
    pdfExporter.MiddleHeader = "Middle header";
    pdfExporter.RightHeader = "Right header";
    pdfExporter.ReverseHeaderOnEvenPages = true;
     
    pdfExporter.FooterHeight = 30;
    pdfExporter.FooterFont = new Font("Arial", 22);
    pdfExporter.LeftFooter = "Left footer";
    pdfExporter.MiddleFooter = "Middle footer";
    pdfExporter.RightFooter = "Right footer";
    pdfExporter.ReverseFooterOnEvenPages = true;
     
    pdfExporter.SummariesExportOption = SummariesOption.ExportAll;
    pdfExporter.FitToPageWidth = true;
    pdfExporter.Scale = 1.2;
    pdfExporter.ExportSettings.Title = "Prueba";
     
    string exportFile = @"..\..\exportedData.pdf";
    using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
    {
    Telerik.WinControls.Export.GridViewPdfExport exporter = new    Telerik.WinControls.Export.GridViewPdfExport(radGrid1);
    Telerik.WinControls.Export.PdfExportRenderer renderer = new Telerik.WinControls.Export.PdfExportRenderer();
    exporter.RunExport(ms, renderer);
     
    using (System.IO.FileStream fileStream = new System.IO.FileStream(exportFile, FileMode.Create, FileAccess.Write)){
    ms.WriteTo(fileStream);}
    }

    Thanks in advance.

     

  2. Dimitar
    Admin
    Dimitar avatar
    1540 posts

    Posted 01 Sep 2016 Link to this post

    Hi Jamsheer,

    Thank you for writing.

    You do not need to use the grid to convert text files to pdf. You can just use the WordsProcessing library. Detailed information is available here: 
    Nevertheless, could you please share the error message observed on your side? You code compiles without errors on mine.

    I am looking forward to your reply.
     
    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. Gustavo
    Gustavo avatar
    3 posts
    Member since:
    Aug 2016

    Posted 05 Sep 2016 in reply to Dimitar Link to this post

    Hi Dimitar,

    It works, but I now have another problem

    My RadGridView does not load any information, I use this 

    DataTable dt = new DataTable();
    dt = objAdmin.Sales();
     
    RadGridView radGrid1 = new RadGridView();
    radGrid1.AutoGenerateColumns = true;
    radGrid1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    radGrid1.MasterTemplate.DataSource = dt;
    What am I doing wrong?

     

     

     

     

    What am I doing wrong?. On the other hand , the library that you recommend me , so I understand not allow me to customize the pdf in order that want to show the information, and information gathering for the use of this is very poor and I do not think Easy to use. for example I can not find how or where to place the path of the plane I want to export file, I found only this
    What am I doing wrong?. On the other hand , the library that you recommend me , so I understand not allow me to customize the pdf in order that want to show the information, and information gathering for the use of this is very poor and I do not think Easy to use. for example I can not find how or where to place the path of the plane I want to export file, I found only this
    What am I doing wrong?. On the other hand , the library that you recommend me , so I understand not allow me to customize the pdf in order that want to show the information, and information gathering for the use of this is very poor and I do not think Easy to use. for example I can not find how or where to place the path of the plane I want to export file, I found only this
    What am I doing wrong?. On the other hand , the library that you recommend me , so I understand not allow me to customize the pdf in order that want to show the information, and information gathering for the use of this is very poor and I do not think Easy to use. for example I can not find how or where to place the path of the plane I want to export file, I found only this
  4. Dimitar
    Admin
    Dimitar avatar
    1540 posts

    Posted 06 Sep 2016 Link to this post

    Hello Gustavo,

    Are you adding the grid to the form or you want to export the data without showing it? If this is the case you need to call the LoadElementTree method and set the BindingContext manually:
    RadGridView radGrid1 = new RadGridView();
    radGrid1.AutoGenerateColumns = true;
    radGrid1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    radGrid1.MasterTemplate.DataSource = dt;
     
    radGrid1.BindingContext = this.BindingContext;
    radGrid1.LoadElementTree();

    I hope this helps. Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  5. Gustavo
    Gustavo avatar
    3 posts
    Member since:
    Aug 2016

    Posted 06 Sep 2016 in reply to Dimitar Link to this post

    Hello Dimitar,

    Yes, I want to export the data without showing it, my project is a console application, I need export a plain text

     

    I have this error

     

    Thanks in advence

  6. Dimitar
    Admin
    Dimitar avatar
    1540 posts

    Posted 07 Sep 2016 Link to this post

    Hello Gustavo,

    You need to make sure that the System.Windows.Forms assembly is referenced. In addition, since you do not have a form you need to create a binding context:
    radGrid1.BindingContext = new BindingContext();

    I hope this will be useful. 

    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  7. JUAN
    JUAN  avatar
    1 posts
    Member since:
    Jul 2011

    Posted 07 Sep 2016 in reply to Dimitar Link to this post

    It´s work , thanks a lot.

    Gustavo

  8. jamsheer
    jamsheer avatar
    9 posts
    Member since:
    Feb 2017

    Posted 2 days and 15 hours ago in reply to Dimitar Link to this post

    Telerik.WinControls.Export.GridViewPdfExport pdfExporter = new Telerik.WinControls.Export.GridViewPdfExport(DgvTrialBalance);
                pdfExporter.FileExtension = ".pdf";
                pdfExporter.ShowHeaderAndFooter = true;
                pdfExporter.HeaderHeight = 30;
                pdfExporter.HeaderFont = new Font("Arial", 22);
     
                //pdfExporter.Logo = System.Drawing.Image.FromFile(@"C:\temp\logo.png");
                //pdfExporter.LeftHeader = "[Logo]";
                //pdfExporter.LogoAlignment = ContentAlignment.MiddleLeft;
                //pdfExporter.LogoLayout = Telerik.WinControls.Export.LogoLayout.Fit;
     
                pdfExporter.MiddleHeader = "Middle header";
                pdfExporter.RightHeader = "Right header";
                pdfExporter.ReverseHeaderOnEvenPages = true;
     
                pdfExporter.FooterHeight = 30;
                pdfExporter.FooterFont = new Font("Arial", 22);
                pdfExporter.LeftFooter = "Left footer";
                pdfExporter.MiddleFooter = "Middle footer";
                pdfExporter.RightFooter = "Right footer";
                pdfExporter.ReverseFooterOnEvenPages = true;
     
                pdfExporter.SummariesExportOption = SummariesOption.ExportAll;
                pdfExporter.FitToPageWidth = true;
                pdfExporter.Scale = 1.2;
                pdfExporter.ExportSettings.Title = "Prueba";
     
                string exportFile = @"..\..\exportedData.pdf";
                 
                using(System.IO.MemoryStream ms = new System.IO.MemoryStream())
                {
                    Telerik.WinControls.Export.GridViewPdfExport exporter = new Telerik.WinControls.Export.GridViewPdfExport(DgvTrialBalance);
                    PdfExportRenderer renderer = new Telerik.WinControls.Export.PdfExportRenderer();
                    exporter.RunExport(ms , renderer);
     
                    using (System.IO.FileStream fileStream = new System.IO.FileStream(exportFile, FileMode.Create, FileAccess.Write))
                    {
                        ms.WriteTo(fileStream);
                    }
                }

    Dimitar said:Hi Gustavo,

    Thank you for writing.

    You need to add a reference to the TelerikExport assembly. This is noted at the begging of the article. 

    In addition, you can use our WordsProcessing library to convert such files, you do not need a UI component for this: WordsProcessing.

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik by Progress

    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.

    Hello Dimitar,
    I want to export a file.txt  to Pdf, I´m using GridViewPdfExport component but this line does not work:
    exporter.RunExport(ms , renderer);

    I have this error

    Thanks in advence

  9. Dimitar
    Admin
    Dimitar avatar
    1540 posts

    Posted 2 days and 13 hours ago Link to this post

    Hi Jamsheer,

    Please note that you do not need the grid exporter in order to convert such files. You can just use the WordsProcessing library. Detailed information is available here:
    In addition, I cannot see the error message. Could you please specify it again? Your code compiles without errors on my side.

    I am looking forward to your reply.
     
    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  10. jamsheer
    jamsheer avatar
    9 posts
    Member since:
    Feb 2017

    Posted 1 day and 23 hours ago in reply to Dimitar Link to this post

    Hello Dimitar,
        I have error message in there in my memeorystream variable its like below
    Thanks in advence

    jamsheer

  11. jamsheer
    jamsheer avatar
    9 posts
    Member since:
    Feb 2017

    Posted 1 day and 23 hours ago in reply to jamsheer Link to this post

    Hello Dimitar,
        I have error message in there in my memeorystream variable its like below
    Thanks in advence
    jamsheer
  12. Dimitar
    Admin
    Dimitar avatar
    1540 posts

    Posted 1 day and 20 hours ago Link to this post

    Hello,

    The method overload that accepts stream was introduced in R2 2016 SP1 (version 2016.2.608). So you need this or newer version in order to export to a stream.

    Please note that you can pass the file name and path directly and export the grid, the stream is used for some cases where you do not want to create a file.

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  13. jamsheer
    jamsheer avatar
    9 posts
    Member since:
    Feb 2017

    Posted 1 day and 16 hours ago in reply to Dimitar Link to this post

    Hello Dimitar,

         I overcome that Issue ,Thanks a lot.

     Now I want to export my RadGridview to Word file also,How could I do ?

    Thanks in advance
    jamsheer

  14. Dimitar
    Admin
    Dimitar avatar
    1540 posts

    Posted 1 day and 16 hours ago Link to this post

    Hi,

    There is no built-in exporter that can export to the docx format. However, this can be achieved and we have an example of it in our demo application (see attached image). 

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  15. jamsheer
    jamsheer avatar
    9 posts
    Member since:
    Feb 2017

    Posted 20 hours ago in reply to Dimitar Link to this post

    Hello Dimitar,
        How could I convert my RadPrintDocument  values to RadFlowDocument, because when export RadGridview to docx file or text file  there we are using RadFlowDocument.

    Where I exported successfully to pdf,xlsx,xls formats, The above issue when exporting to those formats (docx and txt)

    If you can attach example project or sample codes

    Thanks in advance
    jamsheer

  16. Dimitar
    Admin
    Dimitar avatar
    1540 posts

    Posted 16 hours ago Link to this post

    Hi Jamsheer,

    There is no way to convert RadPrintDocumet to RadFlowDocument.

    I do not understand what is your exact requirement. So could you please specify what exactly you want to achieve and why you want to convert these document types?

    I am looking forward to your reply.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top