We're sorry Aspose doesn't work properply without JavaScript enabled.

# Aspose.words blocking some features

Hi,
I want to block some features in word using aspose.words. Specifically, I don’t want Send Behind Text to be selected in Send Backwards from the Page layout field.

@hvkktr Aspose.Words is a document processing library and that is why it is limited to the features available in the document itself and cannot enable or disable MS Word UI features.

Is availabe for floating shapes. So if you make the shape inline with text, this option will not be available. See Shape.WrapType property.

Hi,
Thank you for your return.I want the watermark not to disappear in the post-text section of the watermark. I tried the Shape.WrapType property but the watermark disappears. I would be glad if you help. Related code

var watermark = new Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.TextPlainText);
...
watermark.WrapType=Aspose.Words.Drawing.WrapType.None;
...


@hvkktr Unfortunately, your requirement is not clear enough. Could you please attach your input and expected output documents here?
If you simply need to insert a watermark the same way as MS Word does, you can achieve this using Document.Watermark property. Please see our documentation to learn more about work with watermarks:
https://docs.aspose.com/words/net/working-with-watermark/

Hi,
Can I make the watermark on the same layer as the text or on the top layer?

@hvkktr Watermark is inserted into the documents header, which is under the main document’s body content. This is the same behavior as in MS Word when you insert a watermark.
To insert a watermark in front of the content you have to insert it in the main body, but in this case you will have to insert it on each page of the document. LayoutCollector can help you with this. For example see the following simple code:

Document doc = new Document(@"C:\Temp\in.docx");

// Determine the maximum ZOrted of shapes in the document.
int zOrder = 0;
foreach (Shape s in doc.GetChildNodes(NodeType.Shape, true))
zOrder = System.Math.Max(zOrder, s.ZOrder);
zOrder++;

// Create a watermark shape.
Shape watermark = new Shape(doc, ShapeType.TextPlainText);
watermark.Name = "WaterMark";
// Set up the text of the watermark.
watermark.TextPath.Text = "Hellooo";
watermark.TextPath.Bold = true;
watermark.TextPath.Size = 100;
watermark.TextPath.FontFamily = "Arial";
watermark.Width = 500;
watermark.Height = 100;
watermark.Fill.ForeColor = System.Drawing.Color.Gold; // Try LightGray to get more Word-style watermark
watermark.StrokeColor = System.Drawing.Color.Red; // Try LightGray to get more Word-style watermark
// Text will be directed from the bottom-left to the top-right corner.
watermark.Rotation = 45;
// Place the watermark in the page center.
watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;
watermark.WrapType = WrapType.None;
watermark.HorizontalAlignment = HorizontalAlignment.Center;
watermark.VerticalAlignment = VerticalAlignment.Center;
watermark.ZOrder = zOrder;

// Get paragraphs in the main document body.
List<Node> mainBodyParagraphs = doc.GetChildNodes(NodeType.Paragraph, true).Where(p => p.ParentNode.NodeType == NodeType.Body).ToList();

LayoutCollector layoutCollector = new LayoutCollector(doc);
int pageToInsert = 1;
foreach (Paragraph para in mainBodyParagraphs)
{
int paraPage = layoutCollector.GetEndPageIndex(para);
if (paraPage == pageToInsert)
{
pageToInsert++;

para.AppendChild(watermark.Clone(true));
}
}

doc.Save(@"C:\Temp\out.docx");

// Since we have used LayoutCollector, Aspose.Words cached laytou of the document
// and the modifications we have made are not in the cache.
// Update page layout to reflect the changes in the output fixed Page formats.
doc.UpdatePageLayout();
doc.Save(@"C:\Temp\out.pdf");