Im getting the below error when I edit an existing pptx and add/change something.
Powerpoint found a problem with content in xxxxxxx.pptx. Powerpoint can attempt to repair the presentation.
When I click repair, then the following error
Powerpoint counldnt read some content in xxxxxxxxxx.pptx - Repaired and removed it. Please check your presentation to see if the rest of it looks ok.
All my edits/changes are gone! Here is my code snippet.
- Code: Select all
Presentation uPPT = new Presentation();
try
{
Log.Information($"Opening PPT {pptFName}");
uPPT.LoadFromFile(pptFile);
SizeF slideSize = uPPT.SlideSize.Size;
float halfWidth = (slideSize.Width / 2) - 40;
float halfHeight = (slideSize.Height / 2) - 40;
float fullWidth = slideSize.Width - 40;
float fullHeight = slideSize.Height - 40;
RectangleF halfRect1 = new RectangleF(20, 20, halfWidth, fullHeight );
RectangleF halfRect2 = new RectangleF(20 + halfWidth, 20, halfWidth, fullHeight );
RectangleF fullRect = new RectangleF(20, 20, fullWidth, fullHeight);
if (HasLMData)
{
IChart chart1 = uPPT.Slides[1].Shapes.AppendChart(ChartType.ColumnClustered, halfRect1);
//Populating Datatable
var dtEnabledUsers = licenseData.GlobalList.Select(s => new ChEnabledUsers()
{
EnabledUsers = (int)s.EnabledUsers,
Registrations = (int)s.Registrations,
ReportDate = s.ReportDate
}).JSON2Datatable();
chart1 = InitChartData(chart1, dtEnabledUsers);
chart1.Series.SeriesLabel = chart1.ChartData[0, 1, 0, dtEnabledUsers.Columns.Count - 1];
chart1.Categories.CategoryLabels = chart1.ChartData[1, 0, dtEnabledUsers.Rows.Count, 0];
uPPT.SaveToFile(pptFile, fileFormat: Spire.Presentation.FileFormat.Pptx2013);
uPPT.Dispose();
}
}
catch (Exception ex)
{
Log.Error(ex, "Error while populating PPT");
throw;
}
return "Success";
I can see that you have fixed these issues with hotfix on Spire.Presentation version, but looks like the FreeSpire version is still not fixed.