We arex using FreeSpire.Presentation version 7.8.0 to read the ppt. Its runs for a few times then it starts giving Unknow file format error then either we have to wait for sometime or restart our azure app service to make it work again. Anyone faced this issue or has idea about solution?
Below is the stack trace and function.
Error : Unknown file format.
StackTrace : at sprᦧ.ᜀ() at sprᦧ..ctor(Stream A_0) at sprᦩ.ᜂ() at sprᦩ.ᜄ() at spr.ᜀ(Stream A_0) at spr.ᜁ(Stream A_0) at spr.ᜃ(Stream A_0) at spr..ctor(Stream A_0, sprᩓ A_1) at Spire.Presentation.Presentation.LoadFromStream(Stream stream, FileFormat fileFormat) at Refract.Protrail.Api.Controllers.CompanyManagementDetailController.LoadTemplate(String template) in
//Function that reads the ppt
// LoadFromFile also gives the same error
private Presentation LoadTemplate(string template)
{
using (Presentation ppt = new Spire.Presentation.Presentation())
{
string templatePath = _webHostEnvironment.ContentRootPath + "\\Templates\\" + template;
var bytesTemplate = System.IO.File.ReadAllBytes(templatePath);
using (var ms = new MemoryStream(bytesTemplate,true))
{
try
{
ppt.LoadFromStream(ms, FileFormat.Pptx2013);
return ppt;
}
catch
{
ppt.LoadFromStream(ms, FileFormat.Pptx2013);
return ppt;
}
}
}
}