Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presentation corrupts as Excel file used in chart part is missing while building presentation from slideparts. #15

Open
wants to merge 3 commits into
base: vNext
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions OpenXmlPowerTools/PresentationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,21 @@ private static void CopyChartObjects(ChartPart oldChart, ChartPart newChart)
dataReference.Attribute(R.id).Value = newChart.GetIdOfPart(newPart);
continue;
}
ExtendedPart extendedPart = oldPartIdPair.OpenXmlPart as ExtendedPart;
if (extendedPart != null)
{
ExtendedPart newPart = newChart.AddExtendedPart(extendedPart.RelationshipType, extendedPart.ContentType, ".dat");
using (Stream oldObject = extendedPart.GetStream(FileMode.Open, FileAccess.Read))
using (Stream newObject = newPart.GetStream(FileMode.Create, FileAccess.ReadWrite))
{
int byteCount;
byte[] buffer = new byte[65536];
while ((byteCount = oldObject.Read(buffer, 0, 65536)) != 0)
newObject.Write(buffer, 0, byteCount);
}
dataReference.Attribute(R.id).Value = newChart.GetIdOfPart(newPart);
continue;
}
EmbeddedObjectPart oldEmbeddedObjectPart = oldPartIdPair.OpenXmlPart as EmbeddedObjectPart;
if (oldEmbeddedObjectPart != null)
{
Expand Down