• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 639
  • Last Modified:

export to pdf

I have datagrid of 20 columns, I give click him to export to pdf and it only exports 12 columns. the code to export to pdf if it reads the 20 columns
the component use is: Pintexx.Components.Web.pinPDF
private string PrintResponseView(int viewKey, string themeName, int menuKey)
    {
            StringBuilder htmlForm = new StringBuilder(GetHTMLResponseView(viewKey, headerKey, footerKey, beginingKey, endingKey, fileName, themeName, menuKey));
            pinPDF objPdf = new pinPDF();
               
        objPdf.Html = htmlForm.ToString();
        objPdf.OutputPath = tempPrintFolder;
        objPdf.Orientation = pinPDF.enOrientation.Landscape;
        objPdf.FileName = fileName;
        objPdf.Unit = pinPDF.enUnit.mm;
           
            objPdf.MarginLeft = 10;
        objPdf.MarginRight = 10;
           
            if (!objPdf.Process()) //
        {
            return "Error: " + objPdf.ErrorMessage;
        }
           
             return tempPrintFolder + fileName; //

      }
      This method return "\\\\192.168.11.113\\framework3-shared\\files\\PrintTemp\\621f9b3e-9c13-47d0-ae6f-afdef7e63eb0.pdf"
     
      I tested several and this it is the result
      1. data not found then  show 20 columns
      2. data found then  show 12 columns or 10 columns or 15 columns, following the registries that must export
        
        i attach two file
dataFound.pdf
dataNOTfound.pdf
0
enrique_aeo
Asked:
enrique_aeo
  • 2
3 Solutions
 
jake072Commented:
enrique_aeo,

What you are doing is printing the resulting HTML to a pdf.  If the page doesn't load correctly, then there isn't anything you can do (NO DATA).

If it does print correctly, and you aren't getting all the lines, then I suspect it is due to some paging of the results?

The pdf will ONLY show exactly what is on the page.  Perhaps you would be better to use the actual document.response, rather then calling it in your pdf creation?

Jake
0
 
Alexandre SimõesManager / Technology SpecialistCommented:
Hi,

I never used that pdf converter control, so I can't help you with it.
What I can do is point you a new way of doing that.

For me, the best way of printing a grid is using a report.
Although I don't like Crystal Reports it comes for free with Visual Studio and comes with the print to PDF functionality out of the box.

The report can be as straight as a list or it can be made a bit more pleasant for the eye.

Cheers,
Alex
0
 
Alexandre SimõesManager / Technology SpecialistCommented:
Just to clear one thing...

I say: "the best way of printing a grid is using a report"
I mean, "the best way of printing the contents of a grid is using a report"

For the report you pass the grid's datasource, not the grid itself.

This is obvious, I just wanted to make it clear.

cheers,
Alex
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now