c# - 如何在 c# 中使用 openxml 生成的 word 文档中减小文本的字体大小或间距
问题描述
我正在使用 openxml 成功生成一个 word 文档。我的 Word 文档包含一个饼图和文本。现在的问题是由于高度较低,Legends 中的最后一行被隐藏了,我只有 3 个选项我无法做到。
- 减小字体大小或
- 减少我的文本之间的行距
- 增加图例高度(由于某些障碍,不允许增加图表区域高度)
我尝试了以下场景
- 行距属性,
- 字体大小
- 意图
- 理由
- 文本属性
- 图表区
- 段落属性。
这是代码:
public void CreateChart(List<ChartSubArea> chartList, string variable, string id)
{
dc.Legend legend2 = new dc.Legend();
dc.LegendPosition legendPosition2 = new dc.LegendPosition()
{ val = dc.LegendPositionValues.Right };
dc.Overlay overlay3 = new dc.Overlay() { Val = false };
legend2.Append(legendPosition2);
legend2.Append(overlay3);
dc.TextProperties textPros = new TextProperties();
textPros.Append(new d.BodyProperties());
textPros.Append(new d.ListStyle());
d.Paragraph paragraph = new d.Paragraph();
d.ParagraphProperties paraPros = new d.ParagraphProperties();
d.DefaultParagraphProperties defaultParaPros = new d.DefaultParagraphProperties();
defaultParaPros.Append(new d.LatinFont() { Typeface = "Arial", PitchFamily = 34, CharacterSet = 0 });
defaultParaPros.Append(new d.ComplexScriptFont() { Typeface = "Arial", PitchFamily = 34, CharacterSet = 0 });
paraPros.Append(defaultParaPros);
paragraph.Append(paraPros);
paragraph.Append(new d.EndParagraphRunProperties() { Language = "en-Us" });
textPros.Append(paragraph);
}
解决方案
推荐阅读
- rest - 使用不带标识符的路由参数的 REST API 路径
- apache - 我在 apache 代理上启用了 ssl,但 ssl 有时适用,但有时不适用
- javascript - 运行事件处理程序一次
- vuejs2 - App.vue 中没有 export 语句,但在 main.ts 中导入了 App 模块。这怎么可能?
- c++ - 如何在没有副本的情况下递归创建 QJsonObject
- java - 无法在 Camel 3.8.0 XML 中配置 doCatch 块
- sql - Oracle xmlagg get correct output
- reactjs - 在 ReactJS 中播放连续的音频声音。直播时延迟问题
- javascript - 不和谐.js上exports.help的多个名称
- stream - 播放广播流的 Google Action 在 Google Home 设备上以暂停状态开始