Skip to content

Commit 4d8bc57

Browse files
committed
V1.7.1 Released
1 parent e221274 commit 4d8bc57

File tree

74 files changed

+737
-332
lines changed

Some content is hidden

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

74 files changed

+737
-332
lines changed
Binary file not shown.
69 Bytes
Binary file not shown.

Xceed.Document.NET/Src/Bookmark.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ public void SetText( string text )
4646
this.Paragraph.ReplaceAtBookmark( text, this.Name );
4747
}
4848

49+
public void SetText( string text, Formatting formatting = null )
50+
{
51+
this.Paragraph.ReplaceAtBookmark( text, this.Name, formatting );
52+
}
53+
4954
public void Remove()
5055
{
5156
this.Paragraph.RemoveBookmark( this.Name );

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ public Color Color
389389

390390

391391

392+
392393
#endregion
393394

394395
#region Internal Properties
@@ -407,9 +408,27 @@ internal XElement Xml
407408

408409
internal Series( XElement xml )
409410
{
410-
Xml = xml;
411-
_strCache = xml.Element( XName.Get( "cat", Document.c.NamespaceName ) ).Element( XName.Get( "strRef", Document.c.NamespaceName ) ).Element( XName.Get( "strCache", Document.c.NamespaceName ) );
412-
_numCache = xml.Element( XName.Get( "val", Document.c.NamespaceName ) ).Element( XName.Get( "numRef", Document.c.NamespaceName ) ).Element( XName.Get( "numCache", Document.c.NamespaceName ) );
411+
this.Xml = xml;
412+
413+
var cat = xml.Element( XName.Get( "cat", Document.c.NamespaceName ) );
414+
if( cat != null )
415+
{
416+
_strCache = cat.Descendants( XName.Get( "strCache", Document.c.NamespaceName ) ).FirstOrDefault();
417+
if( _strCache == null )
418+
{
419+
_strCache = cat.Descendants( XName.Get( "strLit", Document.c.NamespaceName ) ).FirstOrDefault();
420+
}
421+
}
422+
423+
var val = xml.Element( XName.Get( "val", Document.c.NamespaceName ) );
424+
if( val != null )
425+
{
426+
_numCache = val.Descendants( XName.Get( "numCache", Document.c.NamespaceName ) ).FirstOrDefault();
427+
if( _numCache == null )
428+
{
429+
_numCache = val.Descendants( XName.Get( "numLit", Document.c.NamespaceName ) ).FirstOrDefault();
430+
}
431+
}
413432
}
414433

415434
public Series( String name )

Xceed.Document.NET/Src/Container.cs

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -725,33 +725,19 @@ public virtual Table InsertTable( int index, Table t )
725725
return newTable;
726726
}
727727

728-
public virtual void InsertSection()
728+
public virtual Section InsertSection()
729729
{
730-
this.InsertSection( false );
730+
return this.InsertSection( false );
731731
}
732732

733-
public virtual void InsertSection( bool trackChanges )
733+
public virtual Section InsertSection( bool trackChanges )
734734
{
735-
var newSection = new XElement( XName.Get( "p", Document.w.NamespaceName ), new XElement( XName.Get( "pPr", Document.w.NamespaceName ), new XElement( XName.Get( "sectPr", Document.w.NamespaceName ), new XElement( XName.Get( "type", Document.w.NamespaceName ), new XAttribute( Document.w + "val", "continuous" ) ) ) ) );
736-
737-
if( trackChanges )
738-
{
739-
newSection = HelperFunctions.CreateEdit( EditType.ins, DateTime.Now, newSection );
740-
}
741-
742-
this.AddElementInXml( newSection );
735+
return null;
743736
}
744737

745-
public virtual void InsertSectionPageBreak( bool trackChanges = false )
738+
public virtual Section InsertSectionPageBreak( bool trackChanges = false )
746739
{
747-
var newSection = new XElement( XName.Get( "p", Document.w.NamespaceName ), new XElement( XName.Get( "pPr", Document.w.NamespaceName ), new XElement( XName.Get( "sectPr", Document.w.NamespaceName ) ) ) );
748-
749-
if( trackChanges )
750-
{
751-
newSection = HelperFunctions.CreateEdit( EditType.ins, DateTime.Now, newSection );
752-
}
753-
754-
this.AddElementInXml( newSection );
740+
return null;
755741
}
756742

757743
public virtual List InsertList( List list )
@@ -971,9 +957,9 @@ private void SetParentContainer( Paragraph newParagraph )
971957
}
972958
}
973959

974-
private ListItemType GetListItemType( string styleName )
960+
private ListItemType GetListItemType( string listItemType )
975961
{
976-
switch( styleName )
962+
switch( listItemType )
977963
{
978964
case "bullet":
979965
return ListItemType.Bulleted;
@@ -984,6 +970,9 @@ private ListItemType GetListItemType( string styleName )
984970

985971
private void InitParagraphs( List<Paragraph> paragraphs )
986972
{
973+
if( (this.Document.Sections == null) || (this.Document.Sections.Count == 0))
974+
return;
975+
987976
foreach( var p in paragraphs )
988977
{
989978
var nextElement = p.Xml.ElementsAfterSelf().FirstOrDefault();

Xceed.Document.NET/Src/CustomProperty.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ internal string Type
5050
private set;
5151
}
5252

53+
internal Formatting Formatting
54+
{
55+
get;
56+
set;
57+
}
58+
5359
#endregion
5460

5561
#region Constructors
@@ -59,8 +65,8 @@ internal string Type
5965
/// </summary>
6066
/// <param name="name">The name of this CustomProperty.</param>
6167
/// <param name="value">The value of this CustomProperty.</param>
62-
public CustomProperty( string name, string value )
63-
: this( name, "lpwstr", value )
68+
public CustomProperty( string name, string value, Formatting formatting = null )
69+
: this( name, "lpwstr", value, formatting )
6470
{
6571
}
6672

@@ -69,8 +75,8 @@ public CustomProperty( string name, string value )
6975
/// </summary>
7076
/// <param name="name">The name of this CustomProperty.</param>
7177
/// <param name="value">The value of this CustomProperty.</param>
72-
public CustomProperty( string name, int value )
73-
: this( name, "i4", value )
78+
public CustomProperty( string name, int value, Formatting formatting = null )
79+
: this( name, "i4", value, formatting )
7480
{
7581
}
7682

@@ -79,8 +85,8 @@ public CustomProperty( string name, int value )
7985
/// </summary>
8086
/// <param name="name">The name of this CustomProperty.</param>
8187
/// <param name="value">The value of this CustomProperty.</param>
82-
public CustomProperty( string name, double value )
83-
: this( name, "r8", value )
88+
public CustomProperty( string name, double value, Formatting formatting = null )
89+
: this( name, "r8", value, formatting )
8490
{
8591
}
8692

@@ -89,8 +95,8 @@ public CustomProperty( string name, double value )
8995
/// </summary>
9096
/// <param name="name">The name of this CustomProperty.</param>
9197
/// <param name="value">The value of this CustomProperty.</param>
92-
public CustomProperty( string name, DateTime value )
93-
: this( name, "filetime", value.ToUniversalTime() )
98+
public CustomProperty( string name, DateTime value, Formatting formatting = null )
99+
: this( name, "filetime", value.ToUniversalTime(), formatting )
94100
{
95101
}
96102

@@ -99,12 +105,12 @@ public CustomProperty( string name, DateTime value )
99105
/// </summary>
100106
/// <param name="name">The name of this CustomProperty.</param>
101107
/// <param name="value">The value of this CustomProperty.</param>
102-
public CustomProperty( string name, bool value )
103-
: this( name, "bool", value )
108+
public CustomProperty( string name, bool value, Formatting formatting = null )
109+
: this( name, "bool", value, formatting )
104110
{
105111
}
106112

107-
internal CustomProperty( string name, string type, string value )
113+
internal CustomProperty( string name, string type, string value, Formatting formatting = null )
108114
{
109115
object realValue;
110116
switch( type )
@@ -146,14 +152,16 @@ internal CustomProperty( string name, string type, string value )
146152
this.Name = name;
147153
this.Type = type;
148154
this.Value = realValue;
155+
this.Formatting = formatting;
149156
}
150157

151-
private CustomProperty( string name, string type, object value )
158+
private CustomProperty( string name, string type, object value, Formatting formatting = null )
152159
{
153160

154161
this.Name = name;
155162
this.Type = type;
156163
this.Value = value;
164+
this.Formatting = formatting;
157165
}
158166

159167
#endregion

0 commit comments

Comments
 (0)