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

26 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
    1778 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
    1778 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
    1778 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
    36 posts
    Member since:
    Feb 2017

    Posted 20 Feb 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
    1778 posts

    Posted 20 Feb 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
    36 posts
    Member since:
    Feb 2017

    Posted 20 Feb 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
    36 posts
    Member since:
    Feb 2017

    Posted 20 Feb 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
    1778 posts

    Posted 21 Feb 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
    36 posts
    Member since:
    Feb 2017

    Posted 21 Feb 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
    1778 posts

    Posted 21 Feb 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
    36 posts
    Member since:
    Feb 2017

    Posted 22 Feb 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
    1778 posts

    Posted 22 Feb 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.
  17. jamsheer
    jamsheer avatar
    36 posts
    Member since:
    Feb 2017

    Posted 25 Feb in reply to Dimitar Link to this post

    Hello Dimitar,

          I tried to  export Radgridview  to Docx file ,but i didnt get the output .
    can u please attach example codes or sample projects
    Thanks in advance
    jamsheer

     

     

  18. jamsheer
    jamsheer avatar
    36 posts
    Member since:
    Feb 2017

    Posted 25 Feb in reply to Dimitar Link to this post

    Hello Dimitar,
          I have getting duplicate value to my radprintpreview from  a grouped radfridview (Actually there i grouped two columns name as ledgergroup and groupname  , some ledgergroup have same groupname because of that its getting duplication ,In this pic look the second marked fields where "sales  is a ledgergroup and the groupname also same as ledgergroup  name as sales")

    i want to avoid that duplicate name at this case.
    Thanks in advance
    jamsheer

  19. Dimitar
    Admin
    Dimitar avatar
    1778 posts

    Posted 27 Feb Link to this post

    Hi Jamsheer,

    We have an example that shows how you can export to docx format in our demo application. You can directly copy the code as well (see attached image). 

    In addition, I am not sure how to reduce the issue with the groups printing. This is why I want to kindly ask you to open a separate thread for this and add the code of your form. This will allow us to properly investigate this and provide you with a solution.

    I hope this will be useful.

    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.
  20. jamsheer
    jamsheer avatar
    36 posts
    Member since:
    Feb 2017

    Posted 01 Mar in reply to Dimitar Link to this post

    Hello Dimitar,
         I want to show printdialog with the all details of print preview without using print preview ,where i created class for Header and footer .

    I can get that with this code (this.Raddatagridview.Print(true);),but there i didnt get Header and footer 

    how could i get it ?
    Thanks in advance
    jamsheer

  21. jamsheer
    jamsheer avatar
    36 posts
    Member since:
    Feb 2017

    Posted 02 Mar in reply to jamsheer Link to this post

    Hello ,

       I got the answer where i used this:

    DgvTrialBalance.Print(true, RadPrintDocument1);

    Thanks,

     

  22. Dimitar
    Admin
    Dimitar avatar
    1778 posts

    Posted 03 Mar Link to this post

    Hello Jamsheer,

    I am glad that you have found a solution for this. 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.
  23. jamsheer
    jamsheer avatar
    36 posts
    Member since:
    Feb 2017

    Posted 06 Mar in reply to Dimitar Link to this post

    Hello Dimitar,
        I want to create a new row at top of my Radgrid look like below.

    where my Radgrid grouping is true
    Thanks in advance
    jamsheer

  24. jamsheer
    jamsheer avatar
    36 posts
    Member since:
    Feb 2017

    Posted 06 Mar in reply to jamsheer Link to this post

    Hello Dimitar,
        How could I change the color of Pinned row of Radgrid,where I have lot of summary rows and I pinned the last total value of my documents .

    Where I used to Pinned Row with this code,

    this.DgvTrialBalance.MasterView.SummaryRows[0].PinPosition = PinnedRowPosition.Bottom;

    I want to change the color where I red marked in the below pic.

    Expecting your help,

    Thanks in advance
    jamsheer

  25. jamsheer
    jamsheer avatar
    36 posts
    Member since:
    Feb 2017

    Posted 06 Mar in reply to jamsheer Link to this post

    Hello Dimitar,

       Expecting your help for those questions.

    Thanks in advance

    jamsheer

  26. Dimitar
    Admin
    Dimitar avatar
    1778 posts

    Posted 07 Mar Link to this post

    Hi Jamsheer,

    1. You can use Column Groups View to create such layout.

    2. Use the ViewCellFormatting event to change the styles of the summary cells:
    private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.CellElement is GridSummaryCellElement)
        {
            e.CellElement.DrawFill = true;
            e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
            e.CellElement.BackColor = Color.Red;
     
        }
        else
        {
            e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
        }
    }

    Off topic, I want to mention that these questions are not related to the original subject of this thread. I want to kindly ask you to use relevant or open new threads for unrelated questions. In addition, could please use just one support channel to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one.

    Thank you for your understanding.

    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