Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.
Wed Jun 29, 2022 2:16 pm
Hi,
I just wanna know is there any way in which we can autofirrows height on the merged cell.
Like we have Cell "A1"and its merged with b1 c1 and d1. then how can set its height automatically when its filled with data.
Height should be according to the data filled in the merged cell.
Is it possible?
-

jassmahal
-
- Posts: 1
- Joined: Mon Nov 01, 2021 9:33 am
Thu Jun 30, 2022 6:47 am
Hi,
Thank you for your inquiry.
We provide the AutoFitRows method to auto-fit row height. Please refer to the code below to achieve your requirement. If it doesn't help, please provide your sample Excel file for further investigation.
- Code: Select all
//Load an excel
Workbook workbook = new Workbook();
workbook.LoadFromFile("test.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Set wrap text
worksheet.Range["A1:D1"].IsWrapText = true;
//Set auto—fit row hight
worksheet.Range["A1:D1"].AutoFitRows();
//Merged cell
worksheet.Range["A1:D1"].Merge();
//Save the excel
workbook.SaveToFile("output.xlsx");
Sincerely,
Kylie
E-iceblue support team
-


kylie.tian
-
- Posts: 412
- Joined: Mon Mar 07, 2022 2:30 am
Thu Jul 21, 2022 3:06 am
Hi,
Has your problem been effectively solved now? Can you give us some feedback at your convenience? Thanks in advance.
Sicnerely,
Kylie
E-iceblue support team
-


kylie.tian
-
- Posts: 412
- Joined: Mon Mar 07, 2022 2:30 am