Hi Team,
A simple open and save action of the attached pptm throws the following exception:
System.Collections.Generic.KeyNotFoundException: The given key ‘Cambria Math’ was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key) at ..(String ) at .(Graphics , , ) at .(IList1 , , )
at .e( )
at e.( )
at e.( )
at e.( )
at .( , & , MathJustification , , Single )
at .( , MathJustification , , Single )
at .( , Boolean , Single )
at .( , Boolean , Char[] )
at .()
at .( , )
at …ctor(TextFrame , , )
at …ctor( , Int32 , Int32 )
at .( )
at .( )
at e.()
at e…ctor(TextFrame , , IBaseSlide , , [] )
at .( , )
at .( , Single , Single , )
at .( , & , RectangleF& , )
at .( , ShapeFrame& , RectangleF& , )
at .( )
at .(IAutoShape , , , e )
at .(AutoShape , , , e )
at .(IShape , , , e )
at .(IGroupShape , , , e )
at .(IBaseSlide , , )
at .(ISlide )
at .(e , ISlide , )
at .(Presentation , ee , IPptxOptions , InterruptionToken )
at .(Presentation , Stream , ee , IPptxOptions , InterruptionToken )
at Aspose.Slides.Presentation.(Stream , ee , IPptxOptions )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)
the code is question is
static private readonly Dictionary<LoadFormat, SaveFormat> LoadFormatToSaveFormat = new Dictionary<LoadFormat, SaveFormat>
{
{LoadFormat.Ppt, SaveFormat.Ppt},
{LoadFormat.Ppt95, SaveFormat.Ppt},
{LoadFormat.Pptx, SaveFormat.Pptx},
{LoadFormat.Pptm, SaveFormat.Pptm},
{LoadFormat.Pot, SaveFormat.Pot},
{LoadFormat.Potx, SaveFormat.Potx},
{LoadFormat.Potm, SaveFormat.Potm},
{LoadFormat.Pps, SaveFormat.Pps},
{LoadFormat.Ppsx, SaveFormat.Ppsx},
{LoadFormat.Ppsm, SaveFormat.Ppsm},
{LoadFormat.Odp, SaveFormat.Odp},
{LoadFormat.Otp, SaveFormat.Otp}
};
var presentationInfo = PresentationFactory.Instance.GetPresentationInfo(inputPath);
var presentation = new Presentation(inputPath);
presentation.Save(outputPath, LoadFormatToSaveFormat[presentationInfo.LoadFormat]);
This exception happens despite ‘Cambria Math’ font being installed and available in the system.
Platfrom: linux
Package: Aspose.Slides.NET6.CrossPlatform Version=“25.10.0”
cambria_math_font_pptm.zip (1.3 MB)