Export a report to an Excel(.xlsx) file problem

Posted by: luo.yang on 18 May 2022, 11:44 am EST

  • Posted 18 May 2022, 11:44 am EST

    Hi,

    I am using C1.C1Report.4.5.2 version for creating and exporting the reports in our application.

    I am getting an issue while exporting the report to an Open XML Excel(.xlsx) file or to Microsoft Excel (.xls) file. The rows are getting merged, which I did not face in other formats like .pdf, .docx.

    Could you help me to fix the issue.

  • Posted 19 May 2022, 4:54 am EST

    Hi,

    We didn’t replicate this behavior at our end.

    Could you please provide a sample that you are facing this issue. And how you are exporting the report, through code or ReportDesigner?

    JFYI, C1Report is in maintenance mode and it is replaced by C1FlexReport. Hence, C1Report is not under development. So, we recommend upgrade to C1FlexReport.

    In order to convert C1Report to C1FlexReport you can refer this blog: https://www.grapecity.com/blogs/3-ways-to-convert-your-c1report-to-flexreport

    Best Regards,

    Nitin.

  • Posted 20 May 2022, 6:52 am EST - Updated 3 October 2022, 10:28 pm EST

    Hi,

    Thanks for your reply.

    I am exporting the report through code like below.

    1. Initialise C1TrueDBGrid object like this:

      grdPrintReport.AllowUpdate = false;

      grdPrintReport.BackColor = System.Drawing.SystemColors.Window;

      grdPrintReport.Images.Add(((System.Drawing.Image)(resources.GetObject(“grdPrintReport.Images”))));

      grdPrintReport.Location = new System.Drawing.Point(8, 8);

      grdPrintReport.MultiSelect = C1.Win.C1TrueDBGrid.MultiSelectEnum.None;

      grdPrintReport.Name = “grdPrintReport”;

      grdPrintReport.PreviewInfo.Location = new System.Drawing.Point(0, 0);

      grdPrintReport.PreviewInfo.Size = new System.Drawing.Size(0, 0);

      grdPrintReport.PreviewInfo.ZoomFactor = 75D;

      grdPrintReport.PrintInfo.PageSettings = ((System.Drawing.Printing.PageSettings)(resources.GetObject(“grdPrintReport.PrintInfo.PageSettings”)));

      grdPrintReport.Size = new System.Drawing.Size(392, 255);

      grdPrintReport.TabIndex = 0;

      grdPrintReport.PropBag = resources.GetString(“grdPrintReport.PropBag”);

    2. Then, adding the datasource to it.

    3. Fetching datarows from it.

    4. Doing some styling to the data and adding it to printpreview object and finally calling C1.Win.C1Preview.C1PreviewPane.FileSave() method. (I hope it internally uses C1.Win.C1Report 4.5.2).

    5. Then, if I am using Print to File option, the data is getting merged in .xlsx and .xls files.

      The data looks fine in preview and in other formats.

      Please find the below screenshots for your reference…

  • Posted 25 May 2022, 3:37 am EST

    Hi,

    We apologize for the delay in response. We could not clearly understand how you have implemented the C1TrueDBGrid and C1Report in your project. Are you creating a C1Report by using the Data from the C1TrueDBGrid? OR are you directly printing the C1TrueDBGrid, which uses the PrintPreviewControl internally?

    Please provide a sample showing your implementation as well as the issue you are facing, so we can investigate accordingly and assist you in the best way possible.

    Kind Regards,

    Kartik

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels