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

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

    Posted 31 Aug 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
    1415 posts

    Posted 01 Sep Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Gustavo
    Gustavo avatar
    3 posts
    Member since:
    Aug 2016

    Posted 05 Sep 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
  5. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 06 Sep 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.
  6. Gustavo
    Gustavo avatar
    3 posts
    Member since:
    Aug 2016

    Posted 06 Sep 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

  7. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 07 Sep 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.
  8. JUAN
    JUAN  avatar
    1 posts
    Member since:
    Jul 2011

    Posted 07 Sep in reply to Dimitar Link to this post

    It´s work , thanks a lot.

    Gustavo

Back to Top
UI for WinForms is Visual Studio 2017 Ready