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
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void Save(Stream stream)
var events = Features.Get<IPartRootEventsFeature>();
events?.OnChange(EventType.Saving, OpenXmlPart);

using (var xmlWriter = XmlWriter.Create(stream, settings))
using (var xmlWriter = new XmlDOMTextWriter(stream, settings))
{
if (_standaloneDeclaration is not null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private static void AddXmlPackagePart(XElement flatOpcPart, IPackage package)
var part = CreatePackagePart(flatOpcPart, package);

using var stream = part.GetStream(FileMode.Create);
using var xmlWriter = XmlWriter.Create(stream);
using var xmlWriter = new XmlDOMTextWriter(stream);

XElement rootElement = flatOpcPart.Elements(Pkg + "xmlData").Elements().First();
rootElement.WriteTo(xmlWriter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("DocumentFormat.OpenXml, Publickey=002400000480000094000000060200000024000052534131000400000100010061d8931836c82bf25ca6b773dfd6e7b3ab4e43fba60cf4a86347170373415a165ccc40da3da4a52163822db9fa91f15828236d32d6a9fe754859f10d1f8262646c1f3fb6b4348123f14d733db0ff11c3198b7cf56caaebbf14563990446a6c32aff36d5a7097194294c127fe3cdf9f2609daae5f4daf26f8b6227f203d2a8bbf")]
[assembly: InternalsVisibleTo("DocumentFormat.OpenXml.Linq, Publickey=002400000480000094000000060200000024000052534131000400000100010061d8931836c82bf25ca6b773dfd6e7b3ab4e43fba60cf4a86347170373415a165ccc40da3da4a52163822db9fa91f15828236d32d6a9fe754859f10d1f8262646c1f3fb6b4348123f14d733db0ff11c3198b7cf56caaebbf14563990446a6c32aff36d5a7097194294c127fe3cdf9f2609daae5f4daf26f8b6227f203d2a8bbf")]

// For testing
[assembly: InternalsVisibleTo("DocumentFormat.OpenXml.Tests, Publickey=002400000480000094000000060200000024000052534131000400000100010061d8931836c82bf25ca6b773dfd6e7b3ab4e43fba60cf4a86347170373415a165ccc40da3da4a52163822db9fa91f15828236d32d6a9fe754859f10d1f8262646c1f3fb6b4348123f14d733db0ff11c3198b7cf56caaebbf14563990446a6c32aff36d5a7097194294c127fe3cdf9f2609daae5f4daf26f8b6227f203d2a8bbf")]
Expand Down
10 changes: 10 additions & 0 deletions src/DocumentFormat.OpenXml.Framework/XmlDOMTextWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ internal class XmlDOMTextWriter : XmlWriter
{
private readonly XmlWriter _writer;

public XmlDOMTextWriter(Stream stream)
{
_writer = Create(stream);
}

public XmlDOMTextWriter(Stream stream, XmlWriterSettings settings)
{
_writer = Create(stream, settings);
}

public XmlDOMTextWriter(TextWriter w)
{
var xwSettings = new XmlWriterSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public bool Save()
}

using (var stream = _part.GetStream(FileMode.Create, FileAccess.Write))
using (var xmlWriter = XmlWriter.Create(stream))
using (var xmlWriter = new XmlDOMTextWriter(stream))
{
_partXDocument.Save(xmlWriter);
}
Expand Down
Loading