|
|
|
|
|
|
|
|
/// <example>
|
|
|
/// <example>
|
|
|
/// Returns a list of all Pictures in a Paragraph.
|
|
|
/// Returns a list of all Pictures in a Paragraph.
|
|
|
/// <code>
|
|
|
/// <code>
|
|
|
|
|
|
/// <![CDATA[
|
|
|
/// // Create a document.
|
|
|
/// // Create a document.
|
|
|
/// using (DocX document = DocX.Load(@"Test.docx"))
|
|
|
/// using (DocX document = DocX.Load(@"Test.docx"))
|
|
|
/// {
|
|
|
/// {
|
|
|
|
|
|
|
|
|
/// // Save this document.
|
|
|
/// // Save this document.
|
|
|
/// document.Save();
|
|
|
/// document.Save();
|
|
|
/// }
|
|
|
/// }
|
|
|
|
|
|
/// ]]>
|
|
|
/// </code>
|
|
|
/// </code>
|
|
|
/// </example>
|
|
|
/// </example>
|
|
|
public List<Picture> Pictures
|
|
|
public List<Picture> Pictures
|
|
|
|
|
|
|
|
|
/// Paragraph p = document.Paragraphs[0];
|
|
|
/// Paragraph p = document.Paragraphs[0];
|
|
|
///
|
|
|
///
|
|
|
/// // Get all of the hyperlinks in this Paragraph.
|
|
|
/// // Get all of the hyperlinks in this Paragraph.
|
|
|
/// List<Hyperlink> hyperlinks = paragraph.Hyperlinks;
|
|
|
|
|
|
|
|
|
/// <![CDATA[ List<Hyperlink> ]]> hyperlinks = paragraph.Hyperlinks;
|
|
|
///
|
|
|
///
|
|
|
/// // Change the first hyperlinks text and Uri
|
|
|
/// // Change the first hyperlinks text and Uri
|
|
|
/// Hyperlink h0 = hyperlinks[0];
|
|
|
/// Hyperlink h0 = hyperlinks[0];
|
|
|
|
|
|
|
|
|
// return newPicture;
|
|
|
// return newPicture;
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Insert a Picture at the end of this paragraph.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="description">A string to describe this Picture.</param>
|
|
|
|
|
|
/// <param name="imageID">The unique id that identifies the Image this Picture represents.</param>
|
|
|
|
|
|
/// <param name="name">The name of this image.</param>
|
|
|
|
|
|
/// <returns>A Picture.</returns>
|
|
|
|
|
|
/// <example>
|
|
|
|
|
|
/// <code>
|
|
|
|
|
|
/// // Create a document using a relative filename.
|
|
|
|
|
|
/// using (DocX document = DocX.Create(@"Test.docx"))
|
|
|
|
|
|
/// {
|
|
|
|
|
|
/// // Add a new Paragraph to this document.
|
|
|
|
|
|
/// Paragraph p = document.InsertParagraph("Here is Picture 1", false);
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Add an Image to this document.
|
|
|
|
|
|
/// Novacode.Image img = document.AddImage(@"Image.jpg");
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Insert pic at the end of Paragraph p.
|
|
|
|
|
|
/// Picture pic = p.InsertPicture(img.Id, "Photo 31415", "A pie I baked.");
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Rotate the Picture clockwise by 30 degrees.
|
|
|
|
|
|
/// pic.Rotation = 30;
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Resize the Picture.
|
|
|
|
|
|
/// pic.Width = 400;
|
|
|
|
|
|
/// pic.Height = 300;
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Set the shape of this Picture to be a cube.
|
|
|
|
|
|
/// pic.SetPictureShape(BasicShapes.cube);
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Flip the Picture Horizontally.
|
|
|
|
|
|
/// pic.FlipHorizontal = true;
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Save all changes made to this document.
|
|
|
|
|
|
/// document.Save();
|
|
|
|
|
|
/// }// Release this document from memory.
|
|
|
|
|
|
/// </code>
|
|
|
|
|
|
/// </example>
|
|
|
|
|
|
/// Removed to simplify the API.
|
|
|
|
|
|
|
|
|
// <summary>
|
|
|
|
|
|
// Insert a Picture at the end of this paragraph.
|
|
|
|
|
|
// </summary>
|
|
|
|
|
|
// <param name="description">A string to describe this Picture.</param>
|
|
|
|
|
|
// <param name="imageID">The unique id that identifies the Image this Picture represents.</param>
|
|
|
|
|
|
// <param name="name">The name of this image.</param>
|
|
|
|
|
|
// <returns>A Picture.</returns>
|
|
|
|
|
|
// <example>
|
|
|
|
|
|
// <code>
|
|
|
|
|
|
// // Create a document using a relative filename.
|
|
|
|
|
|
// using (DocX document = DocX.Create(@"Test.docx"))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // Add a new Paragraph to this document.
|
|
|
|
|
|
// Paragraph p = document.InsertParagraph("Here is Picture 1", false);
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Add an Image to this document.
|
|
|
|
|
|
// Novacode.Image img = document.AddImage(@"Image.jpg");
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Insert pic at the end of Paragraph p.
|
|
|
|
|
|
// Picture pic = p.InsertPicture(img.Id, "Photo 31415", "A pie I baked.");
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Rotate the Picture clockwise by 30 degrees.
|
|
|
|
|
|
// pic.Rotation = 30;
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Resize the Picture.
|
|
|
|
|
|
// pic.Width = 400;
|
|
|
|
|
|
// pic.Height = 300;
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Set the shape of this Picture to be a cube.
|
|
|
|
|
|
// pic.SetPictureShape(BasicShapes.cube);
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Flip the Picture Horizontally.
|
|
|
|
|
|
// pic.FlipHorizontal = true;
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Save all changes made to this document.
|
|
|
|
|
|
// document.Save();
|
|
|
|
|
|
// }// Release this document from memory.
|
|
|
|
|
|
// </code>
|
|
|
|
|
|
// </example>
|
|
|
|
|
|
// Removed to simplify the API.
|
|
|
//public Picture InsertPicture(string imageID, string name, string description)
|
|
|
//public Picture InsertPicture(string imageID, string name, string description)
|
|
|
//{
|
|
|
//{
|
|
|
// Picture p = CreatePicture(Document, imageID, name, description);
|
|
|
// Picture p = CreatePicture(Document, imageID, name, description);
|
|
|
|
|
|
|
|
|
// return p;
|
|
|
// return p;
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Insert a Picture into this Paragraph at a specified index.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="description">A string to describe this Picture.</param>
|
|
|
|
|
|
/// <param name="imageID">The unique id that identifies the Image this Picture represents.</param>
|
|
|
|
|
|
/// <param name="name">The name of this image.</param>
|
|
|
|
|
|
/// <param name="index">The index to insert this Picture at.</param>
|
|
|
|
|
|
/// <returns>A Picture.</returns>
|
|
|
|
|
|
/// <example>
|
|
|
|
|
|
/// <code>
|
|
|
|
|
|
/// // Create a document using a relative filename.
|
|
|
|
|
|
/// using (DocX document = DocX.Create(@"Test.docx"))
|
|
|
|
|
|
/// {
|
|
|
|
|
|
/// // Add a new Paragraph to this document.
|
|
|
|
|
|
/// Paragraph p = document.InsertParagraph("Here is Picture 1", false);
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Add an Image to this document.
|
|
|
|
|
|
/// Novacode.Image img = document.AddImage(@"Image.jpg");
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Insert pic at the start of Paragraph p.
|
|
|
|
|
|
/// Picture pic = p.InsertPicture(0, img.Id, "Photo 31415", "A pie I baked.");
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Rotate the Picture clockwise by 30 degrees.
|
|
|
|
|
|
/// pic.Rotation = 30;
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Resize the Picture.
|
|
|
|
|
|
/// pic.Width = 400;
|
|
|
|
|
|
/// pic.Height = 300;
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Set the shape of this Picture to be a cube.
|
|
|
|
|
|
/// pic.SetPictureShape(BasicShapes.cube);
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Flip the Picture Horizontally.
|
|
|
|
|
|
/// pic.FlipHorizontal = true;
|
|
|
|
|
|
///
|
|
|
|
|
|
/// // Save all changes made to this document.
|
|
|
|
|
|
/// document.Save();
|
|
|
|
|
|
/// }// Release this document from memory.
|
|
|
|
|
|
/// </code>
|
|
|
|
|
|
/// </example>
|
|
|
|
|
|
/// Removed to simplify API.
|
|
|
|
|
|
|
|
|
// <summary>
|
|
|
|
|
|
// Insert a Picture into this Paragraph at a specified index.
|
|
|
|
|
|
// </summary>
|
|
|
|
|
|
// <param name="description">A string to describe this Picture.</param>
|
|
|
|
|
|
// <param name="imageID">The unique id that identifies the Image this Picture represents.</param>
|
|
|
|
|
|
// <param name="name">The name of this image.</param>
|
|
|
|
|
|
// <param name="index">The index to insert this Picture at.</param>
|
|
|
|
|
|
// <returns>A Picture.</returns>
|
|
|
|
|
|
// <example>
|
|
|
|
|
|
// <code>
|
|
|
|
|
|
// // Create a document using a relative filename.
|
|
|
|
|
|
// using (DocX document = DocX.Create(@"Test.docx"))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // Add a new Paragraph to this document.
|
|
|
|
|
|
// Paragraph p = document.InsertParagraph("Here is Picture 1", false);
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Add an Image to this document.
|
|
|
|
|
|
// Novacode.Image img = document.AddImage(@"Image.jpg");
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Insert pic at the start of Paragraph p.
|
|
|
|
|
|
// Picture pic = p.InsertPicture(0, img.Id, "Photo 31415", "A pie I baked.");
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Rotate the Picture clockwise by 30 degrees.
|
|
|
|
|
|
// pic.Rotation = 30;
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Resize the Picture.
|
|
|
|
|
|
// pic.Width = 400;
|
|
|
|
|
|
// pic.Height = 300;
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Set the shape of this Picture to be a cube.
|
|
|
|
|
|
// pic.SetPictureShape(BasicShapes.cube);
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Flip the Picture Horizontally.
|
|
|
|
|
|
// pic.FlipHorizontal = true;
|
|
|
|
|
|
//
|
|
|
|
|
|
// // Save all changes made to this document.
|
|
|
|
|
|
// document.Save();
|
|
|
|
|
|
// }// Release this document from memory.
|
|
|
|
|
|
// </code>
|
|
|
|
|
|
// </example>
|
|
|
|
|
|
// Removed to simplify API.
|
|
|
//public Picture InsertPicture(int index, string imageID, string name, string description)
|
|
|
//public Picture InsertPicture(int index, string imageID, string name, string description)
|
|
|
//{
|
|
|
//{
|
|
|
// Picture picture = CreatePicture(Document, imageID, name, description);
|
|
|
// Picture picture = CreatePicture(Document, imageID, name, description);
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create a new Picture.
|
|
|
/// Create a new Picture.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="document"></param>
|
|
|
/// <param name="id">A unique id that identifies an Image embedded in this document.</param>
|
|
|
/// <param name="id">A unique id that identifies an Image embedded in this document.</param>
|
|
|
/// <param name="name">The name of this Picture.</param>
|
|
|
/// <param name="name">The name of this Picture.</param>
|
|
|
/// <param name="descr">The description of this Picture.</param>
|
|
|
/// <param name="descr">The description of this Picture.</param>
|
|
|
|
|
|
|
|
|
/// </example>
|
|
|
/// </example>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.ReplaceText(string, string, bool)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.ReplaceText(string, string, bool, RegexOptions)"/>
|
|
|
|
|
|
/// <param name="value">The System.String to insert.</param>
|
|
|
/// <param name="value">The System.String to insert.</param>
|
|
|
/// <param name="trackChanges">Flag this insert as a change.</param>
|
|
|
/// <param name="trackChanges">Flag this insert as a change.</param>
|
|
|
/// <param name="formatting">The text formatting.</param>
|
|
|
/// <param name="formatting">The text formatting.</param>
|
|
|
|
|
|
|
|
|
/// </example>
|
|
|
/// </example>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.ReplaceText(string, string, bool)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.ReplaceText(string, string, bool, RegexOptions)"/>
|
|
|
|
|
|
/// <param name="index">The index position of the insertion.</param>
|
|
|
/// <param name="index">The index position of the insertion.</param>
|
|
|
/// <param name="value">The System.String to insert.</param>
|
|
|
/// <param name="value">The System.String to insert.</param>
|
|
|
/// <param name="trackChanges">Flag this insert as a change.</param>
|
|
|
/// <param name="trackChanges">Flag this insert as a change.</param>
|
|
|
|
|
|
|
|
|
/// Append a field of type document property, this field will display the custom property cp, at the end of this paragraph.
|
|
|
/// Append a field of type document property, this field will display the custom property cp, at the end of this paragraph.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="cp">The custom property to display.</param>
|
|
|
/// <param name="cp">The custom property to display.</param>
|
|
|
|
|
|
/// <param name="trackChanges"></param>
|
|
|
/// <param name="f">The formatting to use for this text.</param>
|
|
|
/// <param name="f">The formatting to use for this text.</param>
|
|
|
/// <example>
|
|
|
/// <example>
|
|
|
/// Create, add and display a custom property in a document.
|
|
|
/// Create, add and display a custom property in a document.
|
|
|
/// <code>
|
|
|
/// <code>
|
|
|
///// Load a document.
|
|
|
|
|
|
|
|
|
/// // Load a document.
|
|
|
///using (DocX document = DocX.Create("CustomProperty_Add.docx"))
|
|
|
///using (DocX document = DocX.Create("CustomProperty_Add.docx"))
|
|
|
///{
|
|
|
///{
|
|
|
/// // Add a few Custom Properties to this document.
|
|
|
/// // Add a few Custom Properties to this document.
|
|
|
|
|
|
|
|
|
/// Insert a field of type document property, this field will display the custom property cp, at the end of this paragraph.
|
|
|
/// Insert a field of type document property, this field will display the custom property cp, at the end of this paragraph.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="cp">The custom property to display.</param>
|
|
|
/// <param name="cp">The custom property to display.</param>
|
|
|
|
|
|
/// <param name="trackChanges"></param>
|
|
|
/// <param name="f">The formatting to use for this text.</param>
|
|
|
/// <param name="f">The formatting to use for this text.</param>
|
|
|
/// <example>
|
|
|
/// <example>
|
|
|
/// Create, add and display a custom property in a document.
|
|
|
/// Create, add and display a custom property in a document.
|
|
|
|
|
|
|
|
|
/// }// Release this document from memory.
|
|
|
/// }// Release this document from memory.
|
|
|
/// </code>
|
|
|
/// </code>
|
|
|
/// </example>
|
|
|
/// </example>
|
|
|
/// <seealso cref="Paragraph.ReplaceText(string, string, bool)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.ReplaceText(string, string, bool, RegexOptions)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.InsertText(string, bool)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.InsertText(int, string, bool)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.InsertText(int, string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(int, string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(string, bool, Formatting)"/>
|
|
|
/// <param name="index">The position to begin deleting characters.</param>
|
|
|
/// <param name="index">The position to begin deleting characters.</param>
|
|
|
|
|
|
|
|
|
/// }// Release this document from memory.
|
|
|
/// }// Release this document from memory.
|
|
|
/// </code>
|
|
|
/// </code>
|
|
|
/// </example>
|
|
|
/// </example>
|
|
|
/// <seealso cref="Paragraph.ReplaceText(string, string, bool)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.ReplaceText(string, string, bool, RegexOptions)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.InsertText(int, string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(int, string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(string, bool, Formatting)"/>
|
|
|
/// <param name="index">The position to begin deleting characters.</param>
|
|
|
/// <param name="index">The position to begin deleting characters.</param>
|
|
|
|
|
|
|
|
|
/// </example>
|
|
|
/// </example>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.RemoveText(int, bool)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(string, bool)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.InsertText(int, string, bool)"/>
|
|
|
|
|
|
/// <seealso cref="Paragraph.InsertText(int, string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(int, string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(string, bool, Formatting)"/>
|
|
|
/// <seealso cref="Paragraph.InsertText(string, bool, Formatting)"/>
|
|
|
/// <param name="newValue">A System.String to replace all occurances of oldValue.</param>
|
|
|
/// <param name="newValue">A System.String to replace all occurances of oldValue.</param>
|
|
|
|
|
|
|
|
|
/// foreach(Paragraph p in document.Paragraphs)
|
|
|
/// foreach(Paragraph p in document.Paragraphs)
|
|
|
/// {
|
|
|
/// {
|
|
|
/// // Find all instances of 'go' in this paragraph.
|
|
|
/// // Find all instances of 'go' in this paragraph.
|
|
|
/// List<int> gos = document.FindAll("go");
|
|
|
|
|
|
|
|
|
/// <![CDATA[ List<int> ]]> gos = document.FindAll("go");
|
|
|
///
|
|
|
///
|
|
|
/// /*
|
|
|
/// /*
|
|
|
/// * Insert 'don't' in frount of every instance of 'go' in this document to produce 'don't go'.
|
|
|
/// * Insert 'don't' in frount of every instance of 'go' in this document to produce 'don't go'.
|
|
|
|
|
|
|
|
|
/// foreach(Paragraph p in document.Paragraphs)
|
|
|
/// foreach(Paragraph p in document.Paragraphs)
|
|
|
/// {
|
|
|
/// {
|
|
|
/// // Find all instances of 'go' in this paragraph (Ignore case).
|
|
|
/// // Find all instances of 'go' in this paragraph (Ignore case).
|
|
|
/// List<int> gos = document.FindAll("go", RegexOptions.IgnoreCase);
|
|
|
|
|
|
|
|
|
/// <![CDATA[ List<int> ]]> gos = document.FindAll("go", RegexOptions.IgnoreCase);
|
|
|
///
|
|
|
///
|
|
|
/// /*
|
|
|
/// /*
|
|
|
/// * Insert 'don't' in frount of every instance of 'go' in this document to produce 'don't go'.
|
|
|
/// * Insert 'don't' in frount of every instance of 'go' in this document to produce 'don't go'.
|