获取ppt的Note的字体和文字Size不正确。

问题一:
字体取出来不对,实际字体为[Yu Gothic],取出来的字体为[Calibri]。
※改成 [Yu Gothic]之前的字体为[Calibri]。
请参考测试结果的Page1

问题二:
使用的默认的字体和Size时,取不到字体和Size,Size为NaN,字体为空。
※只有在新建幻灯片后,不改字体和Size的时候才会出现这个问题。改过字体和Size后,这个问题就不再现了。
请参考测试结果的Page2.

测试结果:
TestResult.PNG (1.9 KB)

测试文件:
Test.zip (30.3 KB)

测试代码:

        var p = new Aspose.Slides.Presentation(@".\Test.pptx");

        for (var i = 0; i < p.Slides.Count; i++)
        {
            var text = p.Slides[i].NotesSlideManager.NotesSlide?.NotesTextFrame;
            var pf = text?.Paragraphs[0].Portions[0].PortionFormat;

            if (pf == null)
            {
                continue;
            }
            Console.WriteLine("Note:" + text.Text);
            Console.WriteLine("Size:" + pf.FontHeight);
            Console.WriteLine("Font name:" + (pf.ComplexScriptFont ?? pf.EastAsianFont ?? pf.LatinFont ?? pf.SymbolFont)?.FontName);
            Console.WriteLine();
        }

@fangguoneng,

我建议您尝试使用下面的示例代码来达到目的。 如果字体或高度继承到主题,则返回NaN。 在这种情况下,您需要使用PortionFormat.GetEffective()。FontHeight。

	public static void TestFont()
	{
		String path = @"C:\Aspose Data\FontTes\Test.pptx";
		Presentation pres = new Presentation(path);
		//Console.OutputEncoding = Encoding.UTF8;

		Console.OutputEncoding = Encoding.Unicode; // For UTF-16
		foreach (ISlide slide in pres.Slides)
		{
			var text = slide.NotesSlideManager.NotesSlide?.NotesTextFrame;
			//ITextFrame text = ashp.TextFrame;
			foreach (IParagraph para in text.Paragraphs)
			{
				foreach (IPortion portion in para.Portions)
				{
					IPortionFormat pf = portion.PortionFormat;

					var LatinFont = pf.LatinFont;

					Console.WriteLine("Note:" + text.Text);
					var height = (pf.FontHeight== float.NaN) ? pf.FontHeight : pf.GetEffective().FontHeight;

					Console.WriteLine("Size:" +((pf.FontHeight == float.NaN) ? pf.FontHeight : pf.GetEffective().FontHeight));

					Console.WriteLine("Font name:" + (pf.LatinFont ?? pf.ComplexScriptFont ?? pf.EastAsianFont ?? pf.SymbolFont?? pf.GetEffective().LatinFont ?? pf.GetEffective().ComplexScriptFont ?? pf.GetEffective().EastAsianFont ?? pf.SymbolFont)?.FontName);

					Console.WriteLine();
				}
			}
		}
	}

@mudassir.fayyaz
能够正常取出来了。 谢谢!

@fangguoneng,

感谢您的反馈意见。 我们应该关闭该线程吗?

@mudassir.fayyaz
好的。