本文整理汇总了C#中OpenXmlElement.AppendChild方法的典型用法代码示例。如果您正苦于以下问题:C# OpenXmlElement.AppendChild方法的具体用法?C# OpenXmlElement.AppendChild怎么用?C# OpenXmlElement.AppendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenXmlElement
的用法示例。
在下文中一共展示了OpenXmlElement.AppendChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetMarginBottom
private void SetMarginBottom(OpenXmlElement parent)
{
Paragraph para = parent.AppendChild(new Paragraph());
para.ParagraphProperties = new ParagraphProperties();
DocxMargin.SetBottomMargin(defaultDLMargin, para.ParagraphProperties);
}
示例2: CreateParagraph
private Paragraph CreateParagraph(DocxNode node, OpenXmlElement parent)
{
Paragraph para = parent.AppendChild(new Paragraph());
OnParagraphCreated(node, para);
OnOLParagraphCreated(this, new ParagraphEventArgs(para));
return para;
}
示例3: AddImageToBody
private static void AddImageToBody(OpenXmlElement mainElement, string relationshipId, Image image)
{
long cx = (long)image.Width * (long)((float)914400 / image.HorizontalResolution);
long cy = (long)image.Height * (long)((float)914400 / image.VerticalResolution);
// Define the reference of the image.
var element =
new Drawing(
new DW.Inline(
new DW.Extent() { Cx = cx, Cy = cy },
new DW.EffectExtent()
{
LeftEdge = 0L,
TopEdge = 0L,
RightEdge = 0L,
BottomEdge = 0L
},
new DW.DocProperties()
{
Id = (UInt32Value)1U,
Name = System.Guid.NewGuid().ToString()
},
new DW.NonVisualGraphicFrameDrawingProperties(
new A.GraphicFrameLocks() { NoChangeAspect = true }),
new A.Graphic(
new A.GraphicData(
new PIC.Picture(
new PIC.NonVisualPictureProperties(
new PIC.NonVisualDrawingProperties()
{
Id = (UInt32Value)0U,
Name = System.Guid.NewGuid().ToString() + ".png"
},
new PIC.NonVisualPictureDrawingProperties()),
new PIC.BlipFill(
new A.Blip(
new A.BlipExtensionList(
new A.BlipExtension()
{
Uri =
"{" + System.Guid.NewGuid().ToString() + "}"
})
)
{
Embed = relationshipId,
CompressionState =
A.BlipCompressionValues.Print
},
new A.Stretch(
new A.FillRectangle())),
new PIC.ShapeProperties(
new A.Transform2D(
new A.Offset() { X = 0L, Y = 0L },
new A.Extents() { Cx = cx, Cy = cy }),
new A.PresetGeometry(
new A.AdjustValueList()
) { Preset = A.ShapeTypeValues.Rectangle }))
) { Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" })
));
// Append the reference to body, the element should be in a Run.
mainElement.AppendChild(new Paragraph(new Run(element)));
}