To indent content (images, lists etc.) of a docx using Xceed Words for .NET in C#, you can use the following steps:
Load the document that you want to modify using the Document.Load method.
Find the paragraph or paragraphs that contain the images or lists that you want to indent. You can use the Document.Find method to search for paragraphs by their text or style, or you can use the Document.Paragraphs property to access all of the paragraphs in the document.
Once you have a reference to the paragraph or paragraphs that you want to indent, you can use the Paragraph.IndentationFirstLine or Paragraph.IndentationHanging properties to set the indentation level. The IndentationFirstLine property sets the indentation of the first line of the paragraph, while the IndentationHanging property sets the indentation of all lines except the first line.
To indent an image within a paragraph, you can use the Image.IndentationFirstLine or Image.IndentationHanging properties to set the indentation level for the image. These properties work in the same way as the Paragraph.IndentationFirstLine and Paragraph.IndentationHanging properties.
To indent a list within a paragraph, you can use the List.IndentationFirstLine or List.IndentationHanging properties to set the indentation level for the list. These properties work in the same way as the Paragraph.IndentationFirstLine and Paragraph.IndentationHanging properties.
Save the document with the updated indentation using the Document.Save method.
Here is an example of how you could use these methods to indent an image within a paragraph in a document:
using Xceed.Words.NET;
// Load the document
DocX document = DocX.Load("C:MyDocument.docx");
// Find the paragraph containing the image to indent
Paragraph paragraph = document.Find("Text containing image").First();
// Find the image within the paragraph
Image image = paragraph.FindImages().First();
// Set the indentation of the first line
image.IndentationFirstLine = 1.0;
// Set the indentation of all lines except the first line
image.IndentationHanging = 1.0;
// Save the document
document.Save();
Here is an example of how you could use these methods to indent a list within a paragraph in a document:
using Xceed.Words.NET;
// Load the document
DocX document = DocX.Load("C:MyDocument.docx");
// Find the paragraph containing the list to indent
Paragraph paragraph = document.Find("Text containing list").First();
// Find the list within the paragraph
List list = paragraph.FindLists().First();
// Set the indentation of the first line
list.IndentationFirstLine = 1.0;
// Set the indentation of all lines except the first line
list.IndentationHanging = 1.0;
// Save the document
document.Save();