I want to insert a page break in the right place by calculating the row height,but this problem makes the position calculation wrong. image.jpg (70.6 KB)
public void CreateDemo(string demopath)
{
Workbook workbook = new Workbook();
workbook.Worksheets.Clear();
Style style3 = workbook.CreateStyle();
style3.Font.Size = 12;
style3.IsTextWrapped = true;
var sheet = workbook.Worksheets.Add("test");
sheet.Cells.SetColumnWidthPixel(1, 200); //setwidth
//Spaces in different positions will get different result,40,60
//but if open the excel,they are the same
string str1 = "测试数据的换行问题12121212121212 测试数据换行";
string str2 = "测试数据的换行问题 12121212121212测试数据换行";
Cells cells = sheet.Cells;
cells[1, 1].PutValue(str1);
cells[1, 1].SetStyle(style3);
var h1 = cells[1, 1].GetHeightOfValue();//result is 40
cells[2, 1].PutValue(str2);
cells[2, 1].SetStyle(style3);
var h2 = cells[2, 1].GetHeightOfValue();//result is 60
workbook.Save(demopath, SaveFormat.Xlsx);
@epepep,
We have logged the issue as “CELLSNET-47861” in our database for investigations. Once we will have some news for you, we will update you in this topic.
@ahsaniqbalsidiqui
it dons’t work, after set Chinese font , the height is change, But the heights of the two lines are still different. image.png (4.5 KB) excelview.png (1.5 KB)
In fact, the calculation height of the second line(str2) is accurate.There is something wrong with the height calculation of the first line(str1).
There is no space between Chinese and numbers(str1,测试数据的换行问题121), excel will also wrap lines, but the calculation seems not to consider.
This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.
The issues you have found earlier (filed as CELLSNET-47861) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao