Presentation Localization
Change Language for Presentation and Shape’s Text
- Create an instance of Presentation class.
- Obtain the reference of a slide by using its Index.
- Add an AutoShape of Rectangle type to the slide.
- Add some text to the TextFrame.
- Setting Language Id to text.
- Write the presentation as a PPTX file.
The implementation of the above steps is demonstrated below in an example.
using (Presentation pres = new Presentation("test0.pptx"))
{
IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 200, 50);
shape.AddTextFrame("Text to apply spellcheck language");
shape.TextFrame.Paragraphs[0].Portions[0].PortionFormat.LanguageId = "en-EN";
pres.Save("test1.pptx",Aspose.Slides.Export.SaveFormat.Pptx);
}
FAQ
Does language_id trigger automatic text translation?
No. language_id in Aspose.Slides stores the language for spell-checking and grammar proofing, but it does not translate or change the text content. It is metadata that PowerPoint understands for proofing.
Does language_id affect hyphenation and line breaks during rendering?
In Aspose.Slides, LanguageId is for proofing. Hyphenation quality and line wrapping primarily depend on the availability of proper fonts and layout/line-break settings for the writing system. To ensure correct rendering, make the required fonts available, configure font substitution rules, and/or embed fonts into the presentation.
Can I set different languages within a single paragraph?
Yes. LanguageId is applied at the text portion level, so a single paragraph can mix multiple languages with distinct proofing settings.