Это будет работать только с тегом привязки, поэтому замените встроенный код, найдите приведенный ниже код, он работает для меня
введите код здесь Drawing drawing = new Drawing ();DW.Anchor anchor2 = новый DW.Anchor () {DistanceFromTop = (UInt32Value) 0U, DistanceFromBottom = (UInt32Value) 0U, DistanceFromLeft = (UInt32Value) 114300U, DistanceFromRight = (UInt32Value) 11386UU-значение (11) 166UU (не обязательно), ложное значение (165), BehindDoc = true, Locked = false, LayoutInCell = true, AllowOverlap = true};DW.SimplePosition simplePosition2 = new DW.SimplePosition () {X = 0L, Y = 0L};DW.HorizontPosition horizontalPosition2 = new DW.HorizontPosition () {RelativeFrom = DW.Hor HorizontalRelativePositionValues.Column};DW.PositionOffset positionOffset3 = new DW.PositionOffset ();positionOffset3.Text = "0";horizontalPosition2.Append (positionOffset3);DW.VerticalPosition verticalPosition2 = new DW.VerticalPosition () {RelativeFrom = DW.VerticalRelativePositionValues.Paragraph};DW.PositionOffset positionOffset4 = new DW.PositionOffset ();positionOffset4.Text = "32385";verticalPosition2.Append (positionOffset4);DW.Extent экстент = новый DW.Extent () {Cx = 5950000L, Cy = 745000L};DW.EffectExtent effetctEx = new DW.EffectExtent () {LeftEdge = 0L, TopEdge = 0L, RightEdge = 0L, BottomEdge = 0L,};DW.WrapTight wrapTight1 = new DW.WrapTight () {WrapText = DW.WrapTextValues.BothSides};DW.WrapPolygon wrapPolygon1 = новый DW.WrapPolygon () {Edited = false};DW.StartPoint startPoint1 = новый DW.StartPoint () {X = 0L, Y = 0L};DW.LineTo lineTo1 = новый DW.LineTo () {X = 0L, Y = 21036L};DW.LineTo lineTo2 = новый DW.LineTo () {X = 21551L, Y = 21036L};DW.LineTo lineTo3 = новый DW.LineTo () {X = 21551L, Y = 0L};DW.LineTo lineTo4 = новый DW.LineTo () {X = 0L, Y = 0L};wrapPolygon1.Append (startPoint1);wrapPolygon1.Append (lineTo1);wrapPolygon1.Append (lineTo2);wrapPolygon1.Append (lineTo3);wrapPolygon1.Append (lineTo4);wrapTight1.Append (wrapPolygon1);DW.DocProperties docProperties = new DW.DocProperties () {Id = (UInt32Value) 1U, Name = "Логотип заголовка"};DW.NonVisualGraphicFrameDrawingProperties nonVisualGraphicFrameDrawingProperties = new DW.NonVisualGraphicFrameDrawingProperties ();A.GraphicFrameLocks graphicFrameLocks = new A.GraphicFrameLocks () {NoChangeAspect = true};A.Graphic graphic = new A.Graphic ();A.GraphicData graphicData = new A.GraphicData () {Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture"}; PIC.Picture picture = new PIC.Picture (); PIC.NonVisualPictureProperties nonVisualPictureProperties = new PIC.NonVisualPictureProperties (); PIC.Nonperis ()nonVisualDrawingProperties = new PIC.NonVisualDrawingProperties () {Id = (UInt32Value) 0U, Name = "HeadeLogo.jpeg"}; PIC.NonVisualPictureDrawingProperties.Blip blip = new A.Blip () {Embed = imageLogoHeader, CompressionState = A.BlipCompressionValues.Print}; A.Stretch stretch = new A.Stretch (); A.FillRectangle fillRectangle = new A.FillRectangle (); PIC. ShapeProperties shapeProperties = new PIC.ShapeProperties (новый A.Transform2D (новый A.Offset () {X = 0L, Y = 0L}, новый A.Extents () {Cx = 5950000L, Cy = 745000L}), новый A.PresetGeometry(новый A.AdjustValueList ()) {Preset = A.ShapeTypeValues.Rectangle}); nonVisualPictureProperties.Append (nonVisualDrawingProperties);nonVisualPictureProperties.Append (nonVisualPictureDrawingProperties);picture.Append (nonVisualPictureProperties);blipFill.Append (blip);
stretch.Append (fillRectangle);blipFill.Append (растяжения);picture.Append (blipFill);picture.Append (shapeProperties);graphicData.Append (фото);graphic.Append (graphicData);anchor2.Append (simplePosition2);anchor2.Append (horizontalPosition2);anchor2.Append (verticalPosition2);anchor2.Append (степени);anchor2.Append (effetctEx);anchor2.Append (wrapTight1);anchor2.Append (docProperties);anchor2.Append (nonVisualGraphicFrameDrawingProperties);anchor2.Append (графика);рисунок. Приложение (якорь2);
var header = new Header();
var paragraph = new Paragraph();
var run = new Run();
run.Append(drawing);
Paragraph paragraph2 = new Paragraph() ;
Run run1 = new Run();
Picture picture1 = new Picture();
V.Shape shape1 = new V.Shape() { Id = "WordPictureWatermark75517470", Style = "position:absolute;mso-wrap-style:Tight", AllowInCell = false, Filled = false, Stroked = false, Type = "TextWrappingValues.Tight"} ;
picture1.Append(shape1);
run1.Append(picture1);
paragraph2.Append(run1);
header.Append(paragraph2);
header.Append(
new Paragraph(
new ParagraphProperties(
new ParagraphBorders(
new TopBorder() { Val = bdrCount, Color = bdrColor, Size = bdrSize, Space = bdrSpace },
new LeftBorder() { Val = bdrCount, Color = bdrColor, Size = bdrSize, Space = bdrSpace },
new BottomBorder() { Val = bdrCount, Color = bdrColor, Size = bdrSize, Space = bdrSpace },
new RightBorder() { Val = bdrCount, Color = bdrColor, Size = bdrSize, Space = bdrSpace })),
new Run(run)
),
new Paragraph(
new ParagraphProperties(
new ParagraphBorders(
new TopBorder() { Val = bdrCount, Color = bdrColor, Size = bdrSize, Space = bdrSpace },
new LeftBorder() { Val = bdrCount, Color = bdrColor, Size = bdrSize, Space = bdrSpace },
new BottomBorder() { Val = bdrCount, Color = bdrColor, Size = bdrSize, Space = bdrSpace },
new RightBorder() { Val = bdrCount, Color = bdrColor, Size = bdrSize, Space = bdrSpace }),
new Justification() { Val = txtAlign },
new ParagraphMarkRunProperties(
new RunFonts() { Ascii = fntType, HighAnsi = fntType, ComplexScript = fntType },
new Bold(),
new FontSize() { Val = fntSize },
new FontSizeComplexScript() { Val = fntSize })),
new Run(
new RunProperties(
new RunFonts() { Ascii = fntType, HighAnsi = fntType, ComplexScript = fntType },
new Bold(),
new FontSize() { Val = fntSize },
new FontSizeComplexScript() { Val = fntSize }),
new Text(bText)
)