Height is being overwritten by another property

I have a code that already generates an Excel document, it works fine but with a specific report I see that Rows' Height is being overwritten by another property (I don't know exactly which one), when I open that excel document by using my Excel Desktop Application I don't see the changes related to Height.
But if I open the same document from Excel Online Version (www.office.com) or open it with LibreOffice Calc they display the correct height.

I have changed my code to modify the height of each column created at the end of the execution, and it continues failing.

I think that something is not working in the right order, but I'm not able to find out what order I should use.




Attachment: ExampleOfStyle_1ea15266.zip

8 Replies 1 reply marked as answer

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team August 4, 2020 10:07 AM UTC

Hi Diego, 

Greetings from Syncfusion. 

From the code snippet you have shared us we found that you are using RowHeight and StandardHeight properties along with SetRowHeight method. Please find the respective behaviors below. 

RowHeight – This property gets or sets the specified row height for the cell’s row. 
StandardHeight – This property gest or sets the standard height of entire rows in the worksheet. 
SetRowHeight – This method sets the row height for the specified row. 

RowHeight behavior changes with respect to wrap text and custom height set to the cell. So we request you to share the input Excel document along with complete code snippet which will be helpful for us in analyzing the query. 

Regards, 
Keerthi. 




DB Diego Barriguete August 4, 2020 03:27 PM UTC

Thanks for your answer, about the last part: 

RowHeight behavior changes with respect to wrap text and custom height set to the cell. So we request you to share the input Excel document along with complete code snippet which will be helpful for us in analyzing the query. 


Do you have a document about the effect of wrap and custom height? I need to generate documents with wrap text but set a specified Row Height, so that I have to combine both properties.



DB Diego Barriguete August 4, 2020 05:25 PM UTC

The weird part is that the result is correct if I open the document in LibreOffice and Excel online version (office.com), it only gets wrong in Office desktop version (for PC, Windows 10).

Do you think that I should change the order of my steps depending on the Excel's version? I mean a different order of execution for Excel Desktop or Excel online version?


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team August 5, 2020 12:33 PM UTC

Hi Diego, 

The output Excel document should look same even in Excel desktop or Excel online. As requested in our previous update, it would be helpful for us if you could share the input Excel document and complete code snippet for analyzing the query and provide prompt solution at the earliest. 

Also, kindly confirm the Syncfusion XlsIO version you are using at your end. 

Regards, 
Keerthi. 



DB Diego Barriguete August 5, 2020 06:29 PM UTC

Here's a pretty simple example code, in this code Width columns also is not working.
If you remove "\r\n" from the original example you'll see that the height of rows are not being changed.


Attachment: TestExampleCodeAndOutput_df700dca.zip


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team August 6, 2020 11:49 AM UTC

Hi Diego, 

Thanks for sharing the example. Please find the response for your queries below. 

Query 
Response 
Here's a pretty simple example code, in this code Width columns also is not working. 
You are first trying to set the column width to 40. Here the column width for the columns will be set as 40. 

Then you are trying to auto-fit the column width for the columns. The behavior of AutofitColumns() is to set the columns width with respect to cell in the column with maximum width. 

This is to inform you that the maximum column width Microsoft Excel can accept is 255 characters. Syncfusion XlsIO follows the specifications and limitations of Microsoft Excel. 

Please look into the following link to know more about specifications and limitations of Microsoft Excel. 

If your requirement is to maintain the column width as 40, then please avoid AutofitColumns().  

If you remove "\r\n" from the original example you'll see that the height of rows are not being changed. 
You are first trying to set the row height as 50. Here the row height for the rows will be set as 50. 

Then you are trying to auto-fit the row height for rows. The behavior of AutofitRows() is to set the row height with respect to cell in the row with maximum height. 

We deeply regret to tell you that we are unable to understand your query “If you remove "\r\n" from the original example”. 
 
“\r\n” is considered as WrapText. We guess that you are mentioning to change the content of the cell. 
 
WrapText property for the cell will be true even if you remove the “\r\n” in the content. We suggest you to set the Wraptext property to false, if you wish to avoid the WrapText.  
 
Code Snippet: 
 
worksheet["A2"].WrapText = false; 
 
We have modified your code snippet and prepared a simple sample. The sample can be downloaded from the following link. 



Kindly let us know if the provided explanation helps you. 

Regards, 
Keerthi. 


Marked as answer

DB Diego Barriguete August 19, 2020 04:50 AM UTC

I'll try with that code, but my firsts tests are not working at all.
I need to do more testing.


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team August 19, 2020 10:39 AM UTC

Hi Diego, 

Thanks for the update. We will wait to hear from you. 

Regards, 
Keerthi. 


Loader.
Up arrow icon