Free Support Forum - aspose.com

Cell height has changed


#1

19 lines are incomplete, I want to be pulled up. But I don’t want 14 lines to be pulled up, because the original content of 14 lines is displayed completely.

See Compressed Package for Codes and Files,thanks.

Desktop.zip (55.4 KB)


#2

@huawei,

Thanks for your query.

We have analyzed your scenario and observed that as cells are merged in the sheet, so when rows including merged cells are autofit, those cells would be wrapped with its data and consequently the cells rows would be extended. If you do not want to apply autofit to all rows, then you may choose rows which you want to autofit along with the merged cells and which rows to be auto-fit without merged option, hence it does not seem to be issue with the API. As Aspose.Cells provides a way to set autofit operation on merged range, you may use this option to autofit required cells.

If this information does not fulfill your requirement, please elaborate it more using images and also an expected output file created using Excel only. Provide the steps taken in Excel to convert the source MergedCells.xlsx file into expected output file. It will help us to understand the requirement and provide assistance at the earliest.


#3

Sorry, I didn’t understand your reply.

image.png (33.2 KB)

The red box merge a lot of cells here. The content can be displayed completely, so I don’t want the whole 14 lines to be heighten. The content behind “Due Date” is not displayed completely, so I want 19 lines to be heighten.

I hope to get such a result,only 19 rows to be heighten.
image.png (32.9 KB)

Please tell me how to do it. Thank you.


#4

@huawei,

We are sorry for the inconvenience and thanks for providing images which have clarified the requirement completely.

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42777 - Wrong rows hieght changed while using Autofit rows

#5

@huawei,

Please remove below line from your code otherwise the API will autofit row height according to Cell K14.

options.setAutoFitMergedCells(true);

Let us know your feedback.


#6

If remove “options.setAutoFitMergedCells(true);”,other lines that should have been higher won’t be higher.
image.png (35.3 KB)
For example, these lines.


#7

@huawei,

Thanks for the feedback. We have logged these comments with the ticket and will consider this issue again. We are sorry for the inconvenience caused to you in this regard.


#8

@huawei,

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42777”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.


#9

thank you. :grin:


#10

@huawei,

Please try our latest version/fix: Aspose.Cells for Java v18.12.3 (attached)

Your issue should be fixed in it. Please try this fix with options.setAutoFitMergedCells(true).

Let us know your feedback.
Aspose.Cells for Java_v18.12.3.zip (6.4 MB)


#11

Thank you for solving my problem.:+1:


#13

hi, @Amjad_Sahi
You gave the jar package and found that there was still a problem.
image.png (6.7 KB)
image.png (6.9 KB)

The height of the merged cells is enough to satisfy the content of BILL_TO_ADDRESS,But twelve lines are still higher.

Desktop.zip (33.7 KB)


#14

@huawei,

Thanks for the screenshots, sample code with template files.

I am afraid, auto-fitting merged cells feature may not work in all situations. You may confirm, it will disturb other contents/labels in the sheet in MS Excel too. MS Excel does not provide any compact option in auto-fit operation to accurately perform the task as per your needs. I think for this scenario/ case (for your provided template file), kindly do not auto-fit merged cells, it will work fine as I tested. See the updated sample code for your reference:
e.g
Sample code:

// The path to the documents directory.
String dataDir = “F:\Files\cellheight\Desktop\”;
// Instantiate a new Workbook
Workbook wb = new Workbook(dataDir + “MergedCells.xlsx”);

  		WorkbookDesigner wd = new WorkbookDesigner(wb);
  		//String val = "Accounts Payable SectionnP.O Box 874, P.C 111, Central Post OfficenMuscatnSultanate of OmannTel:+968 24584000 Fax: +968 24584099";
  		wd.setDataSource("BILL_TO_ADDRESS", new String[] {"Accounts Payable SectionnP.O Box 874, P.C 111, Central Post OfficenMuscatnSultanate of OmannTel:+968 24584000 Fax: +968 24584099"});
  		wd.setDataSource("CURRENCY_CODE", new String[] {"USD"});
  		wd.process();

  		// Get the first (default) worksheet
  		Worksheet _worksheet = wb.getWorksheets().get(0);


  		// Create an object for AutoFitterOptions
  		AutoFitterOptions options = new AutoFitterOptions();

// Skip auto-fit for merged cells
options.setAutoFitMergedCells(false);
worksheet.autoFitRows(options);

  		// Save the Excel file
  		wb.save("f:\\files\\AFRFMergedCells1.xlsx");

#15

Because I also have tables in my template, if options. setAutoFitMergedCells (false); then the contents of the tables will not be adaptive, and there will be conflicts. The strict format of this document has troubled me for a long time.:sob:

image.png (60.4 KB)

Desktop.zip (39.6 KB)

See the updated sample code and zip file.


#16

@huawei,

Thanks for the sample code, template file and screenshot.

We noticed the rows heights are not up to the mark. I have logged your sample code and template files against your issue “CELLSJAVA-42777” into our database. We might not correct all the custom oriented test cases. Anyways, we will look into it if we could enhance it further,

Once we have an update on it, we will let you know here.


#17

image.png (41.5 KB)

I found that there were errors in the adaptive height, such as the AA at the end of the line was not shown.

There is an incomplete display.

image.png (40.2 KB)


#18

@huawei,

Thanks for providing us more screenshots.

I have also logged these against your issue into out database for evaluation.

Once we have any new information, we will share it with you.