Пример #1
0
 private static void setLanguageOfShape(PowerPoint.Shape shape, Office.MsoLanguageID language)
 {
     // If this has a text frame, set the language of that
     if (shape.HasTextFrame == Office.MsoTriState.msoTrue)
     {
         shape.TextFrame.TextRange.LanguageID = language;
     }
     // if it is a table, set language of each cell
     else if (shape.HasTable == Office.MsoTriState.msoTrue)
     {
         foreach (PowerPoint.Row row in shape.Table.Rows)
         {
             foreach (PowerPoint.Cell cell in row.Cells)
             {
                 cell.Shape.TextFrame.TextRange.LanguageID = language;
             }
         }
     }
     // if it is a group, start traversing the grouped items tree
     else if (shape.Type == Office.MsoShapeType.msoGroup)
     {
         foreach (PowerPoint.Shape groupedShape in shape.GroupItems)
         {
             setLanguageOfShape(groupedShape, language);
         }
     }
 }
Пример #2
0
 public static void SetLanguage(PowerPoint.Slides slides, Office.MsoLanguageID language)
 {
     foreach (PowerPoint.Slide slide in slides)
     {
         foreach (PowerPoint.Shape shape in slide.Shapes)
         {
             // go to helper method to set the language of the shape
             setLanguageOfShape(shape, language);
         }
     }
     // Also set the default language of the presentation
     Globals.ThisAddIn.Application.ActivePresentation.DefaultLanguageID = language;
 }