Skip to content

Commit

Permalink
V1.2.0 Released
Browse files Browse the repository at this point in the history
  • Loading branch information
XceedBoucherS committed Jun 27, 2018
1 parent 80655a9 commit 85af727
Show file tree
Hide file tree
Showing 70 changed files with 1,053 additions and 525 deletions.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Examples/Samples/Chart/ChartSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static void PieChart()
c.AddSeries( s1 );

// Insert chart into document
document.InsertParagraph( "Expenses(M$) for selected categories of Canada" ).FontSize( 15 ).SpacingAfter( 10d );
document.InsertParagraph( "Expenses(M$) for selected categories in Canada" ).FontSize( 15 ).SpacingAfter( 10d );
document.InsertChart( c );

document.Save();
Expand Down Expand Up @@ -195,7 +195,7 @@ public static void Chart3D()
c.AddSeries( s1 );

// Insert chart into document
document.InsertParagraph( "Expenses(M$) for selected categories of Brazil" ).FontSize( 15 ).SpacingAfter( 10d );
document.InsertParagraph( "Expenses(M$) for selected categories in Brazil" ).FontSize( 15 ).SpacingAfter( 10d );
document.InsertChart( c );

document.Save();
Expand Down
Binary file added Examples/Samples/Chart/Output/3DChart.docx
Binary file not shown.
Binary file added Examples/Samples/Chart/Output/BarChart.docx
Binary file not shown.
Binary file added Examples/Samples/Chart/Output/LineChart.docx
Binary file not shown.
Binary file added Examples/Samples/Chart/Output/PieChart.docx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Examples/Samples/Document/Resources/ReplaceText.docx
Binary file not shown.
Binary file not shown.
Binary file not shown.
28 changes: 23 additions & 5 deletions Examples/Samples/Hyperlink/HyperlinkSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,33 @@ public static void Hyperlinks()
p2.AppendHyperlink( h2 ).Color( Color.Blue ).UnderlineStyle( UnderlineStyle.singleLine );
p2.Append( "." ).SpacingAfter( 40d );

// Create a bookmark anchor.
var bookmarkAnchor = "bookmarkAnchor";
// Add an Hyperlink to this document pointing to a bookmark anchor.
var h3 = document.AddHyperlink( "Special Data", bookmarkAnchor );
// Add a paragraph.
var p3 = document.InsertParagraph( "An hyperlink pointing to a bookmark of this Document has been added at the end of this paragraph: " );
// Append an hyperlink to a paragraph.
p3.AppendHyperlink( h3 ).Color( Color.Red ).UnderlineStyle( UnderlineStyle.singleLine );
p3.Append( "." ).SpacingAfter( 40d );

// Add an Hyperlink to this document.
var h3 = document.AddHyperlink( "microsoft", new Uri( "http://www.microsoft.com" ) );
var h4 = document.AddHyperlink( "microsoft", new Uri( "http://www.microsoft.com" ) );
// Add a paragraph
var p3 = document.InsertParagraph( "The hyperlink from this paragraph has been removed. " );
var p4 = document.InsertParagraph( "The hyperlink from this paragraph has been removed. " );
// Append an hyperlink to a paragraph.
p3.AppendHyperlink( h3 ).Color( Color.Green ).UnderlineStyle( UnderlineStyle.singleLine ).Italic();
p4.AppendHyperlink( h4 ).Color( Color.Green ).UnderlineStyle( UnderlineStyle.singleLine ).Italic();

// Remove the first hyperlink of paragraph 3.
p3.RemoveHyperlink( 0 );
// Remove the first hyperlink of paragraph 4.
p4.RemoveHyperlink( 0 );

// Add a paragraph.
var p5 = document.InsertParagraph( "This is a paragraph containing a" );
// Add a bookmark into the paragraph by setting its bookmark anchor.
p5.AppendBookmark( bookmarkAnchor );
p5.Append( " bookmark " );
p5.Append( "referenced by a hyperlink defined in an earlier paragraph." );
p5.SpacingBefore( 200d );

document.Save();
Console.WriteLine( "\tCreated: Hyperlinks.docx\n" );
Expand Down
Binary file not shown.
Binary file added Examples/Samples/Image/Output/AddPicture.docx
Binary file not shown.
Binary file added Examples/Samples/Image/Output/CopyPicture.docx
Binary file not shown.
Binary file added Examples/Samples/Image/Output/ModifyImage.docx
Binary file not shown.
28 changes: 17 additions & 11 deletions Examples/Samples/Line/LineSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,42 @@ public static void InsertHorizontalLine()
using( var document = DocX.Create( LineSample.LineSampleOutputDirectory + @"InsertHorizontalLine.docx" ) )
{
// Add a title
document.InsertParagraph( "Adding bottom Horizontal lines" ).FontSize( 15d ).SpacingAfter( 50d ).Alignment = Alignment.center;
document.InsertParagraph( "Adding top or bottom Horizontal lines" ).FontSize( 15d ).SpacingAfter( 50d ).Alignment = Alignment.center;

// Add a paragraph with a single line.
var p = document.InsertParagraph();
p.Append( "This is a paragraph with a single line." ).Font( new Font( "Arial" ) ).FontSize( 20 );
p.InsertHorizontalLine( "single", 6, 1, "auto" );
p.Append( "This is a paragraph with a single bottom line." ).Font( new Font( "Arial" ) ).FontSize( 15 );
p.InsertHorizontalLine( HorizontalBorderPosition.bottom, "single", 6, 1, "auto" );
p.SpacingAfter( 20 );

// Add a paragraph with a double green line.
var p2 = document.InsertParagraph();
p2.Append( "This is a paragraph with a double colored line." ).Font( new Font( "Arial" ) ).FontSize( 20 );
p2.InsertHorizontalLine( "double", 6, 1, "green" );
p2.Append( "This is a paragraph with a double bottom colored line." ).Font( new Font( "Arial" ) ).FontSize( 15 );
p2.InsertHorizontalLine( HorizontalBorderPosition.bottom, "double", 6, 1, "green" );
p2.SpacingAfter( 20 );

// Add a paragraph with a triple red line.
var p3 = document.InsertParagraph();
p3.Append( "This is a paragraph with a triple colored line." ).Font( new Font( "Arial" ) ).FontSize( 20 );
p3.InsertHorizontalLine( "triple", 6, 1, "red" );
p3.Append( "This is a paragraph with a triple bottom colored line." ).Font( new Font( "Arial" ) ).FontSize( 15 );
p3.InsertHorizontalLine( HorizontalBorderPosition.bottom, "triple", 6, 1, "red" );
p3.SpacingAfter( 20 );

// Add a paragraph with a single spaced line.
var p4 = document.InsertParagraph();
p4.Append( "This is a paragraph with a spaced line." ).Font( new Font( "Arial" ) ).FontSize( 20 );
p4.InsertHorizontalLine( "single", 6, 12, "auto" );
p4.Append( "This is a paragraph with a spaced bottom line." ).Font( new Font( "Arial" ) ).FontSize( 15 );
p4.InsertHorizontalLine( HorizontalBorderPosition.bottom, "single", 6, 12, "auto" );
p4.SpacingAfter( 20 );

// Add a paragraph with a single large line.
var p5 = document.InsertParagraph();
p5.Append( "This is a paragraph with a large line." ).Font( new Font( "Arial" ) ).FontSize( 20 );
p5.InsertHorizontalLine( "single", 25, 1, "auto" );
p5.Append( "This is a paragraph with a large bottom line." ).Font( new Font( "Arial" ) ).FontSize( 15 );
p5.InsertHorizontalLine( HorizontalBorderPosition.bottom, "single", 25, 1, "auto" );
p5.SpacingAfter( 60 );

// Add a paragraph with a single blue top line.
var p6 = document.InsertParagraph();
p6.Append( "This is a paragraph with a blue top line." ).Font( new Font( "Arial" ) ).FontSize( 15 );
p6.InsertHorizontalLine( HorizontalBorderPosition.top, "single", 6, 1, "blue" );
p5.SpacingAfter( 20 );

document.Save();
Expand Down
Binary file not shown.
Binary file added Examples/Samples/List/Output/AddList.docx
Binary file not shown.
Binary file added Examples/Samples/Margin/Output/Indentation.docx
Binary file not shown.
Binary file added Examples/Samples/Margin/Output/Margins.docx
Binary file not shown.
Binary file added Examples/Samples/Margin/Output/SetDirection.docx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Examples/Samples/Paragraph/Output/Heading.docx
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 20 additions & 1 deletion Examples/Samples/Paragraph/ParagraphSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,17 @@ public static void SimpleFormattedParagraphs()
.Italic()
.Spacing( 5 )
.Append( "highlight" ).Highlight( Highlight.yellow ).UnderlineColor( Color.Blue ).CapsStyle( CapsStyle.caps )
.Append( " and strike through." ).StrikeThrough( StrikeThrough.strike );
.Append( " and strike through." ).StrikeThrough( StrikeThrough.strike )
.SpacingAfter( 40 );

// Insert another Paragraph into this document.
var p3 = document.InsertParagraph();

// Append some text with 2 TabStopPositions.
p3.InsertTabStopPosition( Alignment.center, 216f, TabStopPositionLeader.dot )
.InsertTabStopPosition( Alignment.right, 432f, TabStopPositionLeader.dot )
.Append( "Text with TabStopPositions on Left\tMiddle\tand Right" )
.SpacingAfter( 40 );

// Save this document to disk.
document.Save();
Expand Down Expand Up @@ -205,6 +215,15 @@ public static void TextActions()
// Replace "<COST>" with "$13.95" using an handler
p4.ReplaceText( "<(.*?)>", ReplaceTextHandler, false, RegexOptions.IgnoreCase, null, new Formatting() );

p4.SpacingAfter( 30 );

// Insert another Paragraph into this document.
var p5 = document.InsertParagraph();

// Append some text with track changes
p5.Append( "This is a paragraph where tracking of modifications is used." );
p5.ReplaceText( "modifications", "changes", true );

// Save this document to disk.
document.Save();
Console.WriteLine( "\tCreated: TextActions.docx\n" );
Expand Down
Binary file added Examples/Samples/Parallel/Output/OutputDoc1.docx
Binary file not shown.
Binary file added Examples/Samples/Parallel/Output/OutputDoc2.docx
Binary file not shown.
Binary file added Examples/Samples/Parallel/Output/OutputDoc3.docx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Examples/Samples/Table/Output/ColumnsWidth.docx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Examples/Samples/Table/Output/MergeCells.docx
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion Examples/Samples/Table/TableSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public static void ColumnsWidth()
document.InsertParagraph( "Columns width" ).FontSize( 15d ).SpacingAfter( 50d ).Alignment = Alignment.center;

// Insert a title paragraph.
var p = document.InsertParagraph( "In the following table, the cell's left margin has been removed for rows 2-5 as well as the top/bottom table's borders." ).Bold();
var p = document.InsertParagraph( "In the following table, the cell's left margin has been removed for rows 2-6 as well as the top/bottom table's borders." ).Bold();
p.Alignment = Alignment.center;
p.SpacingAfter( 40d );

Expand Down
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions Examples/bin/Debug/Examples.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
3 changes: 3 additions & 0 deletions Examples/bin/Debug/Examples.vshost.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
11 changes: 11 additions & 0 deletions Examples/bin/Debug/Examples.vshost.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
3 changes: 3 additions & 0 deletions Examples/bin/Release/Examples.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
3 changes: 3 additions & 0 deletions Examples/bin/Release/Examples.vshost.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
11 changes: 11 additions & 0 deletions Examples/bin/Release/Examples.vshost.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
D:\Dev\DocumentLibraries\Release\1.2.0\OpenSource\Generated\Examples\bin\Debug\Examples.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
D:\Dev\DocumentLibraries\Release\1.2.0\OpenSource\Generated\Examples\bin\Release\Examples.exe.config
D:\Dev\DocumentLibraries\Release\1.2.0\OpenSource\Generated\Examples\bin\Release\Examples.exe
D:\Dev\DocumentLibraries\Release\1.2.0\OpenSource\Generated\Examples\bin\Release\Xceed.Words.NET.dll
D:\Dev\DocumentLibraries\Release\1.2.0\OpenSource\Generated\Examples\obj\x86\Release\Xceed.Words.NET.Examples.csprojResolveAssemblyReference.cache
D:\Dev\DocumentLibraries\Release\1.2.0\OpenSource\Generated\Examples\obj\x86\Release\Examples.exe
2 changes: 1 addition & 1 deletion Xceed.Words.NET/AssemblyVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This program is provided to you under the terms of the Microsoft Public
internal static class _XceedVersionInfo
{
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string BaseVersion = "1.1";
public const string BaseVersion = "1.2";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
".0.0";
Expand Down
23 changes: 13 additions & 10 deletions Xceed.Words.NET/Src/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public virtual List<Section> Sections
}
}

XElement body = Xml.Element( XName.Get( "body", DocX.w.NamespaceName ) );
XElement baseSectionXml = body?.Element( XName.Get( "sectPr", DocX.w.NamespaceName ) );
var body = Xml.DescendantsAndSelf( XName.Get( "body", DocX.w.NamespaceName ) ).FirstOrDefault();
var baseSectionXml = body?.Element( XName.Get( "sectPr", DocX.w.NamespaceName ) );

if (baseSectionXml != null)
{
Expand Down Expand Up @@ -313,7 +313,8 @@ public virtual void ReplaceText( string searchValue,
Formatting matchFormatting = null,
MatchFormattingOptions fo = MatchFormattingOptions.SubsetMatch,
bool escapeRegEx = true,
bool useRegExSubstitutions = false )
bool useRegExSubstitutions = false,
bool removeEmptyParagraph = true )
{
if( string.IsNullOrEmpty( searchValue ) )
{
Expand All @@ -332,15 +333,15 @@ public virtual void ReplaceText( string searchValue,
{
foreach( Paragraph p in h.Paragraphs )
{
p.ReplaceText( searchValue, newValue, trackChanges, options, newFormatting, matchFormatting, fo, escapeRegEx, useRegExSubstitutions );
p.ReplaceText( searchValue, newValue, trackChanges, options, newFormatting, matchFormatting, fo, escapeRegEx, useRegExSubstitutions, removeEmptyParagraph );
}
}
}

// ReplaceText int main body of document.
foreach( Paragraph p in this.Paragraphs )
{
p.ReplaceText( searchValue, newValue, trackChanges, options, newFormatting, matchFormatting, fo, escapeRegEx, useRegExSubstitutions );
p.ReplaceText( searchValue, newValue, trackChanges, options, newFormatting, matchFormatting, fo, escapeRegEx, useRegExSubstitutions, removeEmptyParagraph );
}

// ReplaceText in Footers of the document.
Expand All @@ -351,7 +352,7 @@ public virtual void ReplaceText( string searchValue,
{
foreach( Paragraph p in f.Paragraphs )
{
p.ReplaceText( searchValue, newValue, trackChanges, options, newFormatting, matchFormatting, fo, escapeRegEx, useRegExSubstitutions );
p.ReplaceText( searchValue, newValue, trackChanges, options, newFormatting, matchFormatting, fo, escapeRegEx, useRegExSubstitutions, removeEmptyParagraph );
}
}
}
Expand All @@ -367,13 +368,15 @@ public virtual void ReplaceText( string searchValue,
/// <param name="newFormatting"></param>
/// <param name="matchFormatting"></param>
/// <param name="fo"></param>
/// <param name="removeEmptyParagraph">Remove empty paragraph</param>
public virtual void ReplaceText( string searchValue,
Func<string,string> regexMatchHandler,
bool trackChanges = false,
RegexOptions options = RegexOptions.None,
Formatting newFormatting = null,
Formatting matchFormatting = null,
MatchFormattingOptions fo = MatchFormattingOptions.SubsetMatch )
MatchFormattingOptions fo = MatchFormattingOptions.SubsetMatch,
bool removeEmptyParagraph = true )
{
if( string.IsNullOrEmpty( searchValue ) )
{
Expand Down Expand Up @@ -401,14 +404,14 @@ public virtual void ReplaceText( string searchValue,
{
foreach( var p in hf.Paragraphs )
{
p.ReplaceText( searchValue, regexMatchHandler, trackChanges, options, newFormatting, matchFormatting, fo );
p.ReplaceText( searchValue, regexMatchHandler, trackChanges, options, newFormatting, matchFormatting, fo, removeEmptyParagraph );
}
}
}

foreach( var p in this.Paragraphs )
{
p.ReplaceText( searchValue, regexMatchHandler, trackChanges, options, newFormatting, matchFormatting, fo );
p.ReplaceText( searchValue, regexMatchHandler, trackChanges, options, newFormatting, matchFormatting, fo, removeEmptyParagraph );
}
}

Expand Down Expand Up @@ -916,7 +919,7 @@ private void GetListItemType( Paragraph p )
var listItemType = HelperFunctions.GetListItemType( p, Document );
if( listItemType != null )
{
p.ListItemType = GetListItemType( HelperFunctions.GetListItemType( p, Document ) );
p.ListItemType = GetListItemType( listItemType );
}
}

Expand Down
Loading

0 comments on commit 85af727

Please sign in to comment.