Skip to content

Commit

Permalink
Merge branch 'master' into ReleasePreparation
Browse files Browse the repository at this point in the history
  • Loading branch information
vderyushev committed May 22, 2024
2 parents 5395c1f + 99ba2a2 commit c53f31e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions Examples/ApiExamples/ApiExamples/ExFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void Caps()
run.Font.AllCaps = true;
para.AppendChild(run);

para = para.ParentNode.AppendChild(new Paragraph(doc));
para = (Paragraph)para.ParentNode.AppendChild(new Paragraph(doc));

// 2 - Set the SmallCaps flag to display all characters in small capitals:
// If a character is lower case, it will appear in its upper case form
Expand Down Expand Up @@ -201,7 +201,7 @@ public void StrikeThrough()
run.Font.StrikeThrough = true;
para.AppendChild(run);

para = para.ParentNode.AppendChild(new Paragraph(doc));
para = (Paragraph)para.ParentNode.AppendChild(new Paragraph(doc));

run = new Run(doc, "Text with a double-line strikethrough.");
run.Font.DoubleStrikeThrough = true;
Expand Down Expand Up @@ -899,7 +899,7 @@ public void ChangeStyle()

// Convert all uses of one style to another,
// using the above methods to reference old and new styles.
foreach (Run run in doc.GetChildNodes(NodeType.Run, true).OfType<Run>())
foreach (Run run in doc.GetChildNodes(NodeType.Run, true))
{
if (run.Font.StyleName == "Emphasis")
run.Font.StyleName = "Strong";
Expand Down Expand Up @@ -969,7 +969,7 @@ public void Style()
builder.Write("This text is in a custom style.");

// Iterate over every run and add a double underline to every custom style.
foreach (Run run in doc.GetChildNodes(NodeType.Run, true).OfType<Run>())
foreach (Run run in doc.GetChildNodes(NodeType.Run, true))
{
Style charStyle = run.Font.Style;

Expand Down
2 changes: 1 addition & 1 deletion Examples/ApiExamples/ApiExamples/ExPclSaveOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void GetPreservedPaperTrayInformation()

// Paper tray information is now preserved when saving document to PCL format.
// Following information is transferred from document's model to PCL file.
foreach (Section section in doc.Sections.OfType<Section>())
foreach (Section section in doc.Sections)
{
section.PageSetup.FirstPageTray = 15;
section.PageSetup.OtherPagesTray = 12;
Expand Down
2 changes: 1 addition & 1 deletion Examples/ApiExamples/ApiExamples/ExSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public void ModifyPageSetupInAllSections()

// It is important to understand that a document can contain many sections,
// and each section has its page setup. In this case, we want to modify them all.
foreach (Section section in doc.OfType<Section>())
foreach (Section section in doc.GetChildNodes(NodeType.Section, true))
section.PageSetup.PaperSize = PaperSize.Letter;

doc.Save(ArtifactsDir + "Section.ModifyPageSetupInAllSections.doc");
Expand Down
2 changes: 1 addition & 1 deletion Examples/ApiExamples/ApiExamples/ExShape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2757,7 +2757,7 @@ public void OfficeMathRenderer()
//ExFor:NodeRendererBase.OpaqueBoundsInPoints
//ExFor:NodeRendererBase.SizeInPoints
//ExFor:OfficeMathRenderer
//ExFor:OfficeMathRenderer.#ctor(Math.OfficeMath)
//ExFor:OfficeMathRenderer.#ctor(OfficeMath)
//ExSummary:Shows how to measure and scale shapes.
Document doc = new Document(MyDir + "Office math.docx");

Expand Down
12 changes: 6 additions & 6 deletions Examples/ApiExamples/ApiExamples/ExSmartTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class ExSmartTag : ApiExampleBase
//ExFor:CustomXmlProperty.#ctor(String,String,String)
//ExFor:CustomXmlProperty.Name
//ExFor:CustomXmlProperty.Value
//ExFor:Markup.SmartTag
//ExFor:Markup.SmartTag.#ctor(DocumentBase)
//ExFor:Markup.SmartTag.Accept(DocumentVisitor)
//ExFor:Markup.SmartTag.Element
//ExFor:Markup.SmartTag.Properties
//ExFor:Markup.SmartTag.Uri
//ExFor:SmartTag
//ExFor:SmartTag.#ctor(DocumentBase)
//ExFor:SmartTag.Accept(DocumentVisitor)
//ExFor:SmartTag.Element
//ExFor:SmartTag.Properties
//ExFor:SmartTag.Uri
//ExSummary:Shows how to create smart tags.
[Test] //ExSkip
public void Create()
Expand Down
4 changes: 2 additions & 2 deletions Examples/ApiExamples/ApiExamples/ExStyles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void ChangeTocsTabStops()
Document doc = new Document(MyDir + "Table of contents.docx");

// Iterate through all paragraphs with TOC result-based styles; this is any style between TOC and TOC9.
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true).OfType<Paragraph>())
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
if (para.ParagraphFormat.Style.StyleIdentifier >= StyleIdentifier.Toc1 &&
para.ParagraphFormat.Style.StyleIdentifier <= StyleIdentifier.Toc9)
{
Expand All @@ -168,7 +168,7 @@ public void ChangeTocsTabStops()

doc = new Document(ArtifactsDir + "Styles.ChangeTocsTabStops.docx");

foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true).OfType<Paragraph>())
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
if (para.ParagraphFormat.Style.StyleIdentifier >= StyleIdentifier.Toc1 &&
para.ParagraphFormat.Style.StyleIdentifier <= StyleIdentifier.Toc9)
{
Expand Down
22 changes: 11 additions & 11 deletions Examples/ApiExamples/ApiExamples/ExTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ private static int GetChildTableCount(Table table)
{
int childTableCount = 0;

foreach (Row row in table.Rows.OfType<Row>())
foreach (Row row in table.Rows)
{
foreach (Cell Cell in row.Cells.OfType<Cell>())
foreach (Cell Cell in row.Cells)
{
TableCollection childTables = Cell.Tables;

Expand Down Expand Up @@ -686,7 +686,7 @@ public void CloneTable()
Assert.AreEqual(3, doc.GetChildNodes(NodeType.Table, true).Count);
Assert.AreEqual(table.Range.Text, tableClone.Range.Text);

foreach (Cell cell in tableClone.GetChildNodes(NodeType.Cell, true).OfType<Cell>())
foreach (Cell cell in tableClone.GetChildNodes(NodeType.Cell, true))
cell.RemoveAllChildren();

Assert.AreEqual(string.Empty, tableClone.ToString(SaveFormat.Text).Trim());
Expand All @@ -706,7 +706,7 @@ public void AllowBreakAcrossPages(bool allowBreakAcrossPages)
// in one piece if a table spans two pages, which break up along that row.
// If the row is too big to fit in one page, Microsoft Word will push it down to the next page.
// Set the "AllowBreakAcrossPages" property to "true" to allow the row to break up across two pages.
foreach (Row row in table.OfType<Row>())
foreach (Row row in table)
row.RowFormat.AllowBreakAcrossPages = allowBreakAcrossPages;

doc.Save(ArtifactsDir + "Table.AllowBreakAcrossPages.docx");
Expand Down Expand Up @@ -786,8 +786,8 @@ public void KeepTableTogether()

// Enabling KeepWithNext for every paragraph in the table except for the
// last ones in the last row will prevent the table from splitting across multiple pages.
foreach (Cell cell in table.GetChildNodes(NodeType.Cell, true).OfType<Cell>())
foreach (Paragraph para in cell.Paragraphs.OfType<Paragraph>())
foreach (Cell cell in table.GetChildNodes(NodeType.Cell, true))
foreach (Paragraph para in cell.Paragraphs)
{
Assert.True(para.IsInCell);

Expand All @@ -801,7 +801,7 @@ public void KeepTableTogether()
doc = new Document(ArtifactsDir + "Table.KeepTableTogether.docx");
table = doc.FirstSection.Body.Tables[0];

foreach (Paragraph para in table.GetChildNodes(NodeType.Paragraph, true).OfType<Paragraph>())
foreach (Paragraph para in table.GetChildNodes(NodeType.Paragraph, true))
if (para.IsEndOfCell && ((Cell)para.ParentNode).ParentRow.IsLastRow)
Assert.False(para.ParagraphFormat.KeepWithNext);
else
Expand Down Expand Up @@ -991,8 +991,8 @@ public void CheckCellsMerged()
Document doc = new Document(MyDir + "Table with merged cells.docx");
Table table = doc.FirstSection.Body.Tables[0];

foreach (Row row in table.Rows.OfType<Row>())
foreach (Cell cell in row.Cells.OfType<Cell>())
foreach (Row row in table.Rows)
foreach (Cell cell in row.Cells)
Console.WriteLine(PrintCellMergeType(cell));
Assert.AreEqual("The cell at R1, C1 is vertically merged", PrintCellMergeType(table.FirstRow.FirstCell)); //ExSkip
}
Expand Down Expand Up @@ -1066,9 +1066,9 @@ public static void MergeCells(Cell startCell, Cell endCell)
Math.Abs(endCellPos.X - startCellPos.X) + 1,
Math.Abs(endCellPos.Y - startCellPos.Y) + 1);

foreach (Row row in parentTable.Rows.OfType<Row>())
foreach (Row row in parentTable.Rows)
{
foreach (Cell cell in row.Cells.OfType<Cell>())
foreach (Cell cell in row.Cells)
{
Point currentPos = new Point(row.IndexOf(cell), parentTable.IndexOf(row));

Expand Down

0 comments on commit c53f31e

Please sign in to comment.