This is a migrated thread and some comments may be shown as answers.

After export to excel not well formated

3 Answers 297 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
M Kumar
Top achievements
Rank 1
Iron
Veteran
M Kumar asked on 09 Oct 2018, 07:27 AM

Hi,
     After export  from report to excel format, each row combined with 2 rows, i means row override with 1 rows,
screenshot : http://prntscr.com/l3vj4p

output excel file : https://www.dropbox.com/s/cpnbhyv06yobbqh/InsatantReport.xls?dl=0

3 Answers, 1 is accepted

Sort by
0
Ivan Hristov
Telerik team
answered on 12 Oct 2018, 06:57 AM
Hello,

Usually this is due to mispositioned items in the report detail band or table. When exporting to Excel, the report processing engine tries to maintain the designed positions of the items. If the report contains a table, make sure its cell contents are aligned with the cell bounds. If the report is a band report, make sure the items are aligned with each other and that the top and height are equal for the items on a row.

You can check the Design Considerations for Excel Rendering for more recommendations about report layout when exporting to Excel.

If you are unable to determine the issue, please send us the report definition along with some sample data so we can investigate it on our side.

Regards,
Ivan Hristov
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
M Kumar
Top achievements
Rank 1
Iron
Veteran
answered on 19 Oct 2018, 06:55 AM

Hi sir,

           I use the below code to generate the report, After getting the report result we export to xls on that time for each row  we get extra blank row in output xls.

 

  Dim iniLeft As Decimal = 0.02
            Dim iniWidth As Decimal = 1.05

            For Each col As System.Data.DataColumn In datas.Columns


                Dim headerTxt As New Telerik.Reporting.TextBox
                headerTxt.Size = New SizeU(Unit.Inch(1.05), Unit.Inch(0.2))
                headerTxt.Location = New Drawing.PointU(Unit.Inch(iniLeft), Unit.Inch(0.02))
                headerTxt.Style.Font.Bold = True
                headerTxt.Style.Font.Size = New Unit(10)
                headerTxt.Style.VerticalAlign = VerticalAlign.Middle
                headerTxt.Style.TextAlign = HorizontalAlign.Left
                headerTxt.StyleName = "Caption"
                headerTxt.Style.BackgroundColor = Color.FromArgb(121, 167, 227)
                headerTxt.Value = col.ColumnName.ToString
                headerTxt.CanGrow = True
                headerTxt.TextWrap = False
                headerTxt.Multiline = True
                labelsGroupHeader.Items.Add(headerTxt)

                Dim detailsTxt As New Telerik.Reporting.TextBox
                detailsTxt.Size = New SizeU(Unit.Inch(1.05), Unit.Inch(0.2))
                detailsTxt.Location = New Drawing.PointU(Unit.Inch(iniLeft), Unit.Inch(0))
                detailsTxt.Style.Font.Size = New Unit(10)
                detailsTxt.Style.VerticalAlign = VerticalAlign.Middle
                detailsTxt.Style.TextAlign = HorizontalAlign.Left
                detailsTxt.StyleName = "Data"
                detailsTxt.CanGrow = True
                detailsTxt.TextWrap = True
                detailsTxt.Multiline = True

                detailsTxt.Value = "=Fields.[" + col.ColumnName.ToString & "]"
                detail.Items.Add(detailsTxt)


                iniLeft = iniLeft + iniWidth


            Next

Here the output xls file link

https://www.dropbox.com/s/yqko1y2fttkd7cu/InsatantReport.xls?dl=0

 

0
Ivan Hristov
Telerik team
answered on 22 Oct 2018, 12:02 PM
Hello,

From the provided source code it seems the items are correctly positioned, but the generation of additional rows depends on the height of the report sections as well. This code sets the height of the text boxes to 0.2 inch, but if the report section is 0.3 inch high, the difference of 0.1 inch will be represented as a new row in Excel export. The engine generates such row in order to preserve the designed report layout.

I have made a small report based on the provided code with a sample CSV data. You can see since the report detail section is 0.2 inch no additional rows are generated. However, on the group header row there is a very thin generated row (index 3), which is due to the location of the headerTxt textbox. It is positioned at 0.02 inch from the top, which produces the new row. The solution is to adjust the report items so they won't have any gaps between them and their containers (report sections). The produced Excel file is also included in the archive.

I hope you will find the attached example useful.

Regards,
Ivan Hristov
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
M Kumar
Top achievements
Rank 1
Iron
Veteran
Answers by
Ivan Hristov
Telerik team
M Kumar
Top achievements
Rank 1
Iron
Veteran
Share this question
or