We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Incomplete display of cell contents

Desktop.zip (61.9 KB)

Because the generated excel document goes directly to the PDF, it is important for us to have a full display here.

image.png (4.1 KB)

@huawei,

Thanks for the template file, sample code and screenshot.

You are right, there are still some glitches when auto-fitting merged cells in the worksheet. The data is not fully displaying for some cells in certain cases. I simply used a simple test code by opening your output Excel file and apply auto-fit operation but it still does not take into account.
e.g
Sample code:

// The path to the documents directory.
String dataDir = "F:\\Files\\incomplete display\\Desktop\\";

// Instantiate a new Workbook
Workbook wb = new Workbook(dataDir + "AFRFMergedCells.xlsx");

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

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

// Set auto-fit for merged cells
options.setAutoFitMergedCells(true);

// Autofit rows in the sheet(including the merged cells)
_worksheet.autoFitRows(options);

// Save the Excel file
wb.save(dataDir + "out1.xlsx");

I have logged a ticket with an id “CELLSJAVA-42816” for your issue. We will look into it soon.

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

@huawei,

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

Your issue should be fixed in it.
Aspose.Cells for Java_v19.1.2.zip (6.4 MB)

Let us know your feedback.

image.png (25.9 KB)

It’s the same as before,the data is not fully displaying for some cells in certain cases.

@huawei,

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

@huawei,

Please try our latest version/fix: Aspose.Cells for Java v19.1.4:

aspose-cells-19.1.4.zip

Let us know your feedback.

The problem still hasn’t been solved.
image.png (36.1 KB)

@huawei,

Thanks for the screenshot.

Could you provide your output Excel file (by Aspose.Cells for Java v19.1.4), we will check it soon.

We also thank you for your continuous work to provide your test data/cases and evaluate/test new fixes (we provide) against your scenarios.

Desktop.zip (61.8 KB)

@huawei,

Thanks for the archive containing sample files.

I noticed the issue is still there for certain cells. I have logged the files against your issue into our database. I have also reopened your issue. We will look into it soon.

@huawei,

Please share your default font of your MS Excel. The default font will be automatically changed in different regional settings. The default font in the template file is “宋体”, so each column’s (A-AJ) width is 14, therefore, the Row 27 can display all characters of K27 if the row height is 30 pixels.
Please try the following sample code code:
e.g
Sample code:

Workbook wb = new Workbook(sourceFileDir + "AFRFMergedCells.xlsx");

```
Style style = wb.getDefaultStyle();
style.getFont().setName("Calibri");
wb.setDefaultStyle(style);
// Get the first (default) worksheet
Worksheet _worksheet = wb.getWorksheets().get(0);
```

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

```
// Set auto-fit for merged cells
options.setAutoFitMergedCells(true);
```

```
// Autofit rows in the sheet(including the merged cells)
_worksheet.autoFitRows(options);
```

```
// Save the Excel file
wb.save(sourceFileDir + "dest.xlsx");
```

Is there a better solution? Because there may be several types of fonts in the excel template, you can’t solve the display problem by setting the font, such as when I set the font to be calibri, the English can be complete, but the Chinese is incomplete.
image.png (3.9 KB)

When setting the song font(“宋体”), both Chinese and English displays are incomplete.
image.png (20.9 KB)

There is a limit to the company’s online transmission. The font file of “宋体” exceeds the size limit and cannot be uploaded. You can download it online,font name is simsun.ttc.

We have many templates and various fonts. Please help us find a better solution. Thank you.

Hi,
Please share the result of the following codes:

System.out.println(wb.getDefaultStyle().getFont().getName());
System.out.println(wb.getDefaultStyle().getFont().getSchemeType());
System.out.println(_worksheet.getCells().getColumnWidthPixel(10));

result:
宋体
2
14

Hi,
The stored default font is “宋体” in the template file,but the displayed default font is “Calibri” in your Excel of machine for the language setting of MS Excel.
It’s behavior of MS Excel.
And the columns’s width is different with different default font.
There are 3 solutions :
1, Change the scheme type of the default font as none, then font will be fixed.
a),Update the template file in MS Excel, set the default font’s name without brackets
b),Change font scheme type:
Style style = wb.getDefaultStyle();
style.getFont().setSchemeType(FontSchemeType.NONE);
wb.setDefaultStyle(style);

2, sets the region when opening the file, then Aspose.Cells will automatically get the local default font.
LoadOptions loadOptions = new LoadOptions();
loadOptions.setRegion(CountryCode.USA);
Workbook wb = new Workbook(sourceFileDir + “AFRFMergedCells.xlsx”,loadOptions);
3, Update the default font name
Style style = wb.getDefaultStyle();
style.getFont().setName(“Calibri”);
wb.setDefaultStyle(style);

I tried solution 2, which seems to solve the problem.

Hi,
It’s better to use 1st solution The font will be fixed in everyone’s machine, then you do not need to worry about that the font will be changed.

a),Update the template file in MS Excel, set the default font’s name without brackets.

“set the default font’s name without brackets”,I don’t understand what this means.

image1.png (100.5 KB)
image2.png (96.2 KB)
Please check the attached image files.
1,The font name is Calibri(Body) in image1.png, it means that the font will be changed in different region setting.
2, The font name is Calibri in image2.png, it does not contains any parentheses, so it’s fixed.
if you can not update the template file, you can change font scheme type with Aspose.Cells, see 1,b) in above post.

The issues you have found earlier (filed as CELLSJAVA-42816) have been fixed in Aspose.Cells for Java 19.2. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi