Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions OpenXmlFormats/Spreadsheet/Styles/CT_Border.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,15 @@ public CT_Border()
}
public override string ToString()
{
MemoryStream ms = new MemoryStream();
StreamWriter sw = new StreamWriter(ms);
using MemoryStream ms = new MemoryStream();
using StreamWriter sw = new StreamWriter(ms);
this.Write(sw, "border");
sw.Flush();
ms.Position = 0;
using (StreamReader sr = new StreamReader(ms))
{
return sr.ReadToEnd();
}
using StreamReader sr = new StreamReader(ms);
return sr.ReadToEnd();
}

public static CT_Border Parse(XmlNode node, XmlNamespaceManager namespaceManager)
{
if (node == null)
Expand Down
37 changes: 22 additions & 15 deletions OpenXmlFormats/Spreadsheet/Styles/CT_Colors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ internal void Write(StreamWriter sw, string nodeName)
sw.Write(string.Format("</{0}>", nodeName));
}

public override string ToString()
{
using MemoryStream ms = new MemoryStream();
using StreamWriter sw = new StreamWriter(ms);
Write(sw, "colors");
sw.Flush();
ms.Position = 0;
using StreamReader sr = new StreamReader(ms);
return sr.ReadToEnd();
}

public bool IsSetIndexedColors()
{
return this.indexedColors != null;
Expand Down Expand Up @@ -335,18 +346,6 @@ public bool IsSetTint()
}
#endregion tint

//internal static XmlSerializer serializer = new XmlSerializer(typeof(CT_Color));
//internal static XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces(new XmlQualifiedName[] {
// new XmlQualifiedName("", "http://schemas.openxmlformats.org/spreadsheetml/2006/main") });
//public override string ToString()
//{
// using (StringWriter stringWriter = new StringWriter())
// {
// serializer.Serialize(stringWriter, this, namespaces);
// return stringWriter.ToString();
// }
//}

public static CT_Color Parse(XmlNode node, XmlNamespaceManager namespaceManager)
{
if (node == null)
Expand All @@ -365,9 +364,6 @@ public static CT_Color Parse(XmlNode node, XmlNamespaceManager namespaceManager)
return ctObj;
}




internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<{0}", nodeName));
Expand All @@ -383,6 +379,17 @@ internal void Write(StreamWriter sw, string nodeName)
sw.Write("/>");
}

public override string ToString()
{
using MemoryStream ms = new MemoryStream();
using StreamWriter sw = new StreamWriter(ms);
Write(sw, "color");
sw.Flush();
ms.Position = 0;
using StreamReader sr = new StreamReader(ms);
return sr.ReadToEnd();
}

public CT_Color Copy()
{
var res = new CT_Color();
Expand Down
9 changes: 0 additions & 9 deletions OpenXmlFormats/Spreadsheet/Styles/CT_Font.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,6 @@ internal void Write(StreamWriter sw, string nodeName)
sw.Write(string.Format("</{0}>", nodeName));
}


//public static string GetString(CT_Font font)
//{
// using (StringWriter writer = new StringWriter())
// {
// serializer.Serialize(writer, font, namespaces);
// return writer.ToString();
// }
//}
#region name
[XmlElement]
public CT_FontName name
Expand Down
13 changes: 7 additions & 6 deletions OpenXmlFormats/Spreadsheet/Styles/CT_Xf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,13 @@ internal void Write(StreamWriter sw, string nodeName, bool writingCellStyle=fals

public override string ToString()
{
XmlSerializer serializer = new XmlSerializer(typeof(CT_Xf));
using (StringWriter stream = new StringWriter())
{
serializer.Serialize(stream, this);
return stream.ToString();
}
using MemoryStream ms = new MemoryStream();
using StreamWriter sw = new StreamWriter(ms);
Write(sw, "xf", true);
sw.Flush();
ms.Position = 0;
using StreamReader sr = new StreamReader(ms);
return sr.ReadToEnd();
}

public bool IsSetFontId()
Expand Down
2 changes: 1 addition & 1 deletion ooxml/XSSF/UserModel/XSSFClientAnchor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ internal CT_Marker From
* @return ending anchor point
*/

internal CT_Marker To
public CT_Marker To
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you change this method to public?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some time this field is null (Anchor is CT_OneCellAnchor), some time it is not null (CT_TwoCellAnchor),
when it is null, and try to get Dx2, Col2, Row2, will throw exception
I need to distinguish it, maybe there are other methods, but I haven't found them

{
get
{
Expand Down
Loading