简体   繁体   English

在合并的单元格中设置Excel wrapText

[英]Aspose excel wrapText in a merged Cell

This issue is occurred in Excel, but this issue became explicit during Aspose update. 此问题发生在Excel中,但在Aspose更新过程中此问题变得很明显。

Rendering an excel, 渲染一个excel,

Set the A0 IsWrapText to true. 将A0 IsWrapText设置为true。

Put value at A0 with value "Hello\\nWorld", then merge with A1. 将值为“ Hello \\ nWorld”的值放在A0,然后与A1合并。

The output of the excel didn't cater the wrapText correctly as it is a merged cell. excel的输出未正确满足wrapText,因为它是合并的单元格。

PS the old version (4.4 or something lower) actually has no this issue, as the AutoFitHeight is not executed by default, thus no change to cell height and the cell height can be growth with the content [catered the \\n]) PS旧版本(4.4或更低版本)实际上没有此问题,因为默认情况下不执行AutoFitHeight,因此,单元格高度没有变化,并且单元格高度可以随着内容的增长而增加[\\ n])

Is there anyway wrapText can be rendered correctly even in a merged cell? 无论如何,即使在合并的单元格中,wrapperText仍可以正确呈现?

Thanks. 谢谢。

Yes, in newer versions of Aspose.Cells, you may try to add the following lines of code (after applying style/formatting to the merged cell) to auto-adjust row(s) height for merged cells accordingly: eg Sample code: 是的,在较新版本的Aspose.Cells中,您可以尝试添加以下代码行(在将样式/格式应用于合并的单元格之后)以相应地自动调整合并单元格的行高:例如示例代码:

.............
AutoFitterOptions options = new AutoFitterOptions();
            options.AutoFitMergedCells = true;
            worksheet.AutoFitRows(options);
........

Hope, this helps a bit. 希望这个对你有帮助。

I am working as Support developer/ Evangelist at Aspose. 我在Aspose担任技术支持/开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM