Skip to content

Commit cb7170a

Browse files
committed
V2.0.0 Released
1 parent abef293 commit cb7170a

File tree

108 files changed

+2489
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+2489
-358
lines changed

Xceed.Document.NET/AssemblyVersionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
2121
internal static class _XceedVersionInfo
2222
{
2323
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
24-
public const string BaseVersion = "1.8";
24+
public const string BaseVersion = "2.0";
2525
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
2626
public const string Version = BaseVersion +
2727
".0.0";

Xceed.Document.NET/Properties/AssemblyInfo.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
2323
// set of attributes. Change these attribute values to modify the information
2424
// associated with an assembly.
2525
[assembly: AssemblyTitle( "Xceed Document for .NET" )]
26-
[assembly: AssemblyDescription( "This assembly implements the classes for Xceed Document for .NET Standard." )]
26+
[assembly: AssemblyDescription( "This assembly implements the classes for Xceed Document for .NET." )]
2727

2828
[assembly: AssemblyCompany( "Xceed Software Inc." )]
29-
[assembly: AssemblyProduct( "Xceed Document for .NET Standard" )]
29+
[assembly: AssemblyProduct( "Xceed Document for .NET" )]
3030
[assembly: AssemblyCopyright( "Copyright (C) Xceed Software Inc. 2009-2021" )]
3131
[assembly: AssemblyCulture("")]
3232

@@ -52,6 +52,13 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
5252
"131b925dcf84a73d22264352eca7c3fcf9387f3eee1d60ac7974f04866e6c72928dc0609abe341" +
5353
"f92cbfb5")]
5454

55+
[assembly: InternalsVisibleTo( "Xceed.Words.NET5" + ",PublicKey=" +
56+
"0024000004800000940000000602000000240000525341310004000001000100d59d8147eb2015" +
57+
"ca98a92da860fd766d101271d8c2f545894870fd6183255737d79347bbf5250291ae75651e1150" +
58+
"1b7452ee003b80b936614cdda51db8eb6f8fde913e67d45395b480a992be17bf04744a7fe803ea" +
59+
"131b925dcf84a73d22264352eca7c3fcf9387f3eee1d60ac7974f04866e6c72928dc0609abe341" +
60+
"f92cbfb5")]
61+
5562
[assembly: InternalsVisibleTo( "Xceed.PdfCreator.NET" + ",PublicKey=" +
5663
"0024000004800000940000000602000000240000525341310004000001000100d59d8147eb2015" +
5764
"ca98a92da860fd766d101271d8c2f545894870fd6183255737d79347bbf5250291ae75651e1150" +
@@ -66,6 +73,13 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
6673
"131b925dcf84a73d22264352eca7c3fcf9387f3eee1d60ac7974f04866e6c72928dc0609abe341" +
6774
"f92cbfb5")]
6875

76+
[assembly: InternalsVisibleTo( "Xceed.PdfCreator.NET5" + ",PublicKey=" +
77+
"0024000004800000940000000602000000240000525341310004000001000100d59d8147eb2015" +
78+
"ca98a92da860fd766d101271d8c2f545894870fd6183255737d79347bbf5250291ae75651e1150" +
79+
"1b7452ee003b80b936614cdda51db8eb6f8fde913e67d45395b480a992be17bf04744a7fe803ea" +
80+
"131b925dcf84a73d22264352eca7c3fcf9387f3eee1d60ac7974f04866e6c72928dc0609abe341" +
81+
"f92cbfb5")]
82+
6983
[assembly: InternalsVisibleTo( "UnitTests" + ",PublicKey=" +
7084
"0024000004800000940000000602000000240000525341310004000001000100d59d8147eb2015" +
7185
"ca98a92da860fd766d101271d8c2f545894870fd6183255737d79347bbf5250291ae75651e1150" +
@@ -79,6 +93,8 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
7993

8094

8195

96+
97+
8298
#pragma warning disable 1699
8399
[assembly: AssemblyDelaySign( false )]
84100
[assembly: AssemblyKeyFile( @"..\..\sn.snk" )]
772 Bytes
Binary file not shown.
291 Bytes
Binary file not shown.

Xceed.Document.NET/Src/Bookmark.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public string Name
2424
{
2525
get; set;
2626
}
27+
2728
public Paragraph Paragraph
2829
{
2930
get; set;

Xceed.Document.NET/Src/Charts/Axis.cs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
1515

1616

1717
using System;
18+
using System.ComponentModel;
19+
using System.Linq;
20+
using System.Xml;
1821
using System.Xml.Linq;
1922

2023
namespace Xceed.Document.NET
@@ -25,12 +28,19 @@ namespace Xceed.Document.NET
2528
/// </summary>
2629
public abstract class Axis
2730
{
31+
32+
#region Private properties
33+
34+
35+
#endregion
36+
37+
2838
#region Public Properties
2939

3040
/// <summary>
3141
/// ID of this Axis
3242
/// </summary>
33-
public String Id
43+
public string Id
3444
{
3545
get
3646
{
@@ -41,7 +51,7 @@ public String Id
4151
/// <summary>
4252
/// Return true if this axis is visible
4353
/// </summary>
44-
public Boolean IsVisible
54+
public bool IsVisible
4555
{
4656
get
4757
{
@@ -60,7 +70,25 @@ public Boolean IsVisible
6070

6171

6272

63-
#endregion
73+
74+
75+
76+
77+
78+
#endregion
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
90+
91+
6492

6593
#region Internal Properties
6694

Xceed.Document.NET/Src/Charts/Chart.cs

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public abstract class Chart
3333
{
3434
#region Private Members
3535

36+
private Paragraph _parentParagraph;
37+
private PackageRelationship _packageRelationship;
38+
3639

3740
#endregion
3841

@@ -54,13 +57,10 @@ public List<Series> Series
5457
get
5558
{
5659
var series = new List<Series>();
57-
var ser = XName.Get( "ser", Document.c.NamespaceName );
58-
int index = 1;
59-
foreach( var element in ChartXml.Elements( ser ) )
60+
var ser = ChartXml.Elements( XName.Get( "ser", Document.c.NamespaceName ) );
61+
foreach( var element in ser )
6062
{
61-
element.Add( new XElement( XName.Get( "idx", Document.c.NamespaceName ) ), index.ToString() );
6263
series.Add( new Series( element ) );
63-
++index;
6464
}
6565
return series;
6666
}
@@ -91,15 +91,25 @@ public ChartLegend Legend
9191
/// </summary>
9292
public CategoryAxis CategoryAxis
9393
{
94-
get; private set;
94+
get
95+
{
96+
var catAxXML = ChartRootXml.Descendants( XName.Get( "catAx", Document.c.NamespaceName ) ).SingleOrDefault();
97+
98+
return ( catAxXML != null ) ? new CategoryAxis( catAxXML ) : null;
99+
}
95100
}
96101

97102
/// <summary>
98103
/// Represents the values axis
99104
/// </summary>
100105
public ValueAxis ValueAxis
101106
{
102-
get; private set;
107+
get
108+
{
109+
var valAxXML = ChartRootXml.Descendants( XName.Get( "valAx", Document.c.NamespaceName ) ).SingleOrDefault();
110+
111+
return ( valAxXML != null ) ? new ValueAxis( valAxXML ) : null;
112+
}
103113
}
104114

105115
/// <summary>
@@ -220,11 +230,11 @@ public Chart()
220230
// if axes exists, create their
221231
if( this.IsAxisExist )
222232
{
223-
this.CategoryAxis = new CategoryAxis( "148921728" );
224-
this.ValueAxis = new ValueAxis( "154227840" );
233+
var categoryAxis = new CategoryAxis( "148921728" );
234+
var valueAxis = new ValueAxis( "154227840" );
225235

226-
var axIDcatXml = XElement.Parse( String.Format( @"<c:axId val=""{0}"" xmlns:c=""http://schemas.openxmlformats.org/drawingml/2006/chart""/>", this.CategoryAxis.Id ) );
227-
var axIDvalXml = XElement.Parse( String.Format( @"<c:axId val=""{0}"" xmlns:c=""http://schemas.openxmlformats.org/drawingml/2006/chart""/>", this.ValueAxis.Id ) );
236+
var axIDcatXml = XElement.Parse( String.Format( @"<c:axId val=""{0}"" xmlns:c=""http://schemas.openxmlformats.org/drawingml/2006/chart""/>", categoryAxis.Id ) );
237+
var axIDvalXml = XElement.Parse( String.Format( @"<c:axId val=""{0}"" xmlns:c=""http://schemas.openxmlformats.org/drawingml/2006/chart""/>", valueAxis.Id ) );
228238

229239
var gapWidth = this.ChartXml.Element( XName.Get( "gapWidth", Document.c.NamespaceName ) );
230240
if( gapWidth != null )
@@ -238,8 +248,8 @@ public Chart()
238248
this.ChartXml.Add( axIDvalXml );
239249
}
240250

241-
plotAreaXml.Add( this.CategoryAxis.Xml );
242-
plotAreaXml.Add( this.ValueAxis.Xml );
251+
plotAreaXml.Add( categoryAxis.Xml );
252+
plotAreaXml.Add( valueAxis.Xml );
243253
}
244254

245255
this.ChartRootXml = this.Xml.Root.Element( XName.Get( "chart", Document.c.NamespaceName ) );
@@ -301,6 +311,33 @@ public void RemoveLegend()
301311
}
302312
}
303313

314+
public void Remove()
315+
{
316+
if( _packageRelationship.Package != null )
317+
{
318+
_packageRelationship.Package.DeletePart( _packageRelationship.TargetUri );
319+
}
320+
321+
if( _parentParagraph.Document.PackagePart != null )
322+
{
323+
_parentParagraph.Document.PackagePart.DeleteRelationship( _packageRelationship.Id );
324+
}
325+
326+
// Remove the Xml from document.
327+
var parentParagrahChart = _parentParagraph.Xml.Descendants( XName.Get( "chart", Document.c.NamespaceName ) )
328+
.FirstOrDefault( c => c.GetAttribute( XName.Get( "id", "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ) ) == _packageRelationship.Id );
329+
if( parentParagrahChart != null )
330+
{
331+
var parentDrawing = parentParagrahChart.Ancestors( XName.Get( "drawing", Document.w.NamespaceName ) ).FirstOrDefault();
332+
if( parentDrawing != null )
333+
{
334+
parentDrawing.Remove();
335+
}
336+
}
337+
}
338+
339+
340+
304341

305342
#endregion
306343

@@ -529,10 +566,10 @@ public void Bind( IList categories, IList values )
529566
for( int index = 0; index < categories.Count; index++ )
530567
{
531568
pt = new XElement( XName.Get( "pt", Document.c.NamespaceName ), new XAttribute( XName.Get( "idx" ), index ),
532-
new XElement( XName.Get( "v", Document.c.NamespaceName ), categories[ index ].ToString() ) );
569+
new XElement( XName.Get( "v", Document.c.NamespaceName ), categories[index].ToString() ) );
533570
_strCache.Add( pt );
534571
pt = new XElement( XName.Get( "pt", Document.c.NamespaceName ), new XAttribute( XName.Get( "idx" ), index ),
535-
new XElement( XName.Get( "v", Document.c.NamespaceName ), values[ index ].ToString() ) );
572+
new XElement( XName.Get( "v", Document.c.NamespaceName ), values[index].ToString() ) );
536573
_numCache.Add( pt );
537574
}
538575
}

Xceed.Document.NET/Src/Container.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ public virtual List<List> Lists
179179
}
180180
}
181181
}
182-
lists.Add( list );
182+
183+
if( list.Items.Count > 0 )
184+
{
185+
lists.Add( list );
186+
}
187+
183188
return lists;
184189
}
185190
}
@@ -1028,10 +1033,18 @@ private void InitParagraphs( List<Paragraph> paragraphs )
10281033
foreach( var p in paragraphs )
10291034
{
10301035
var nextElement = p.Xml.ElementsAfterSelf().FirstOrDefault();
1031-
if( ( nextElement == null ) && p.IsInSdt() )
1036+
if ((nextElement == null) && p.IsInSdt())
10321037
{
10331038
nextElement = p.GetParentSdt().ElementsAfterSelf().FirstOrDefault();
10341039
}
1040+
else if ((nextElement != null) && nextElement.Name.Equals(Document.w + "sdt"))
1041+
{
1042+
var sdtContent = nextElement.Element(XName.Get("sdtContent", Document.w.NamespaceName));
1043+
if (sdtContent != null)
1044+
{
1045+
nextElement = sdtContent.Element(XName.Get("tbl", Document.w.NamespaceName));
1046+
}
1047+
}
10351048
var containsSectionBreak = p.GetOrCreate_pPr().Element( XName.Get( "sectPr", Document.w.NamespaceName ) );
10361049
// Add FollowingTable to paragraph....only when paragraph is not the last one from a section.
10371050
while( ( nextElement != null ) && ( nextElement.Name.Equals( Document.w + "tbl" ) ) && ( containsSectionBreak == null ) )

Xceed.Document.NET/Src/CustomProperty.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ internal CustomProperty( string name, string type, string value, Formatting form
141141

142142
case "bool":
143143
{
144-
realValue = bool.Parse( value );
144+
realValue = ( value == "0" )
145+
? false
146+
: ( value == "1" ) ? true : bool.Parse( value );
145147
break;
146148
}
147149

0 commit comments

Comments
 (0)