c# - 如何使用 NPOI 删除行之间的额外间距
问题描述
我是新开发人员,需要您的帮助
我正在使用 NPOI 创建基于 txt 文件的 word 文档。已经有一个单词示例,格式还可以。
正如您在这张图片中看到的,线条之间的空间很窄:
在我使用 NPOI 创建 Word 文档后,新文件的段落间距更大:
每次我在 word 文档中添加新文本时,我都会设置:
private static void SetParagraphRunSettings(XWPFRun paragraphRun)
{
paragraphRun.FontSize = 7;
paragraphRun.FontFamily = "Courier New";
paragraphRun.IsBold = true;
}
private static void SetParagraphSettings(XWPFParagraph paragraph, string stepComment)
{
if (stepComment.Contains("Landscate -"))
{
paragraph.IndentationFirstLine = 0;
paragraph.FirstLineIndent = 0;
paragraph.IndentationLeft = 1; //(int)(0.002 * 20); // 0.64 Cm = 0.002 inches
paragraph.IndentationHanging = 1; //(int)(0.002 * 20); // 0.64 Cm = 0.002 inches
}
paragraph.Alignment = ParagraphAlignment.LEFT;
paragraph.IndentationRight = 0;
paragraph.SpacingBefore = 0;
paragraph.SpacingAfter = 0;
// Line Spcing = Sigle
paragraph.setSpacingBetween(1, LineSpacingRule.AUTO);
}
解决方案
您可以在https://github.com/nissl-lab/npoi-examples/issues中创建问题吗?我想检查这是否是最新 NPOI 的错误。
推荐阅读
- javascript - 如何获取 ContentEditable 元素中相对于 innerText 的插入符号位置?
- python-3.x - 如何在后台运行 Flask 应用程序 python 代码以避免 504 错误?
- flutter - DropdownButton 不改变值且无法重用
- reactjs - 在heroku中部署Web应用程序时出现应用程序错误
- python - 如何让 textX 模型将第五个测试用例视为单独的行
- python - Weighted average grouping by date (in index) in pandas DataFrame
- python - pyarrow随机导致段错误
- excel - 如何在 VBA 中使用 Range 和变量
- validation - 我们如何使用 Javascript 或 PHP 检查 URL 是否处于活动状态?
- python - 来自 2 个列表的所有排列,但以元素数量为条件