Microsoft PowerPoint文件管理控件Aspose.Slides最新版功能推荐——支持字体回退

近期,Aspose.Slides for .NET更新至最新版v19.10,现在有一些非常有趣且实用的功能值得为大家讲解一下,比如新增支持字体回退,以及在占位符中设置提示文本,接下来通过一些简单的示例来为大家说明一下!

*正版优惠进行时,想要购买Aspose正版授权的朋友可以联系客服哦~


支持字体回退

当遇到的字符不属于任何其他可用字体的组成部分时,将使用后备字体中的符 代替。通常,后备字体将包含代表各种类型的Unicode字符的符 。现在,该支持也已成为Aspose.Slides的一部分。

下面的代码示例演示如何使用FontFallBackRule对象设置字体回退。

 uint startUnicodeIndex = 0x0B80;            uint endUnicodeIndex = 0x0BFF;            IFontFallBackRule firstRule = new FontFallBackRule(startUnicodeIndex, endUnicodeIndex, "Vijaya");            IFontFallBackRule secondRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho, MS Gothic");            //字体列表也可以通过几种方式添加:            string[] fontNames = new string[] { "Segoe UI Emoji, Segoe UI Symbol", "Arial" };            IFontFallBackRule thirdRule = new FontFallBackRule(0x1F300, 0x1F64F, fontNames);

与此类似的基于Java的示例:

Presentation presentation = new Presentation();    try {    IFontFallBackRulesCollection userRulesList = new FontFallBackRulesCollection();    userRulesList.add(new FontFallBackRule(0x0B80, 0x0BFF, "Vijaya"));    userRulesList.add(new FontFallBackRule(0x3040, 0x309F, "MS Mincho, MS Gothic"));    presentation.getFontsManager().setFontFallBackRulesCollection(userRulesList);    } finally {    if (presentation != null) presentation.dispose();    }

在占位符中设置提示文本

一个提示文本是当它是第一负载,但是当用户开始输入到该消失出现在文本字段的文本的文本字段。基本上,这是为了使用户易于了解要在所选字段中输入的内容。我们知道标准布局和预构建布局包含带有默认文本的占位符,如Click添加标题  或  Click添加字幕。使用Aspose.Slides可以通过访问默认占位符来手动添加提示文本。下面的代码段显示了如何使用此功能:

// The path to the documents directory.string dataDir = RunExamples.GetDataDir_Text();using (Presentation pres = new Presentation(dataDir + "Presentation2.pptx")){    ISlide slide = pres.Slides[0];    foreach (IShape shape in slide.Slide.Shapes) // iterate through the slide    {        if (shape.Placeholder != null && shape is AutoShape)        {            string text = "";            if (shape.Placeholder.Type == PlaceholderType.CenteredTitle) // title - the text is empty, PowerPoint displays "Click to add title".             {                text = "Click to add custom title";            }            else if (shape.Placeholder.Type == PlaceholderType.Subtitle) // the same for subtitle.            {                text = "Click to add custom subtitle";            }            ((IAutoShape)shape).TextFrame.Text = text;            Console.WriteLine($"Placeholder with text: {text}");        }    }    pres.Save(dataDir + "Placeholders_PromptText.pptx", SaveFormat.Pptx);}

还想要更多吗可以点击阅读【2019 · Aspose最新资源整合】查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询


如果您对Aspose有任何需求和疑难,记得扫描下方二维码告诉我们哦~

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2019年10月2日
下一篇 2019年10月2日

相关推荐

发表回复

登录后才能评论