![](/img/trans.png)
[英]C# How do I append a Cell to every Row in a Excel Sheet using OpenXmlWriter (OpenXML SDK 2.5)
[英]C# How to insert a frame into a wordprocessingdocument using the openxml sdk v 2.5
有谁知道如何使用openxml sdk v 2.5在wordprocessingdocument中使用框架? 我正在使用openxml sdk v 2.5在WPF应用程序中编辑docx文件。 我有几个对象,例如表格文本和图像,并且我希望在它们周围有一个框架,因此它们不会在页面末尾分开。
尝试了这个:
Frame frame = new Frame(xmlElementList);
document.MainDocumentPart.Document.AppendChild(frame);
但是在将框架添加到文档后,docx文件无效并且无法用word打开
您可以创建ParagraphProperties并将其添加到您的Paragraph中,如下所示
ParagraphProperties paragraphProperties = new ParagraphProperties
{
KeepNext = new KeepNext(),
FrameProperties = new FrameProperties
{
HorizontalSpace = "141",
Wrap = TextWrappingValues.Around,
HorizontalPosition = HorizontalAnchorValues.Text,
VerticalPosition = VerticalAnchorValues.Text, Y = "1"
}
};
Paragraph paragraph=new Paragraph();
paragragh.ParagraphProperties =paragraphProperties;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.