public void CreateBullet(int sldNum, string shpname) { try { PowerPoint.TextRange txtRng = ActivePPT.Slides[sldNum].Shapes[shpname].TextFrame.TextRange; float indentVal = (float)0.64; var paragraphs = txtRng.Paragraphs(-1, -1); for (int index = 1; index <= txtRng.Paragraphs().Count; index++) { //string paraText = txtRng.Paragraphs(index).Text; txtRng.Paragraphs(index).IndentLevel = index; txtRng.Paragraphs(index).ParagraphFormat.Alignment = PowerPoint.PpParagraphAlignment.ppAlignLeft; txtRng.Paragraphs(index).ParagraphFormat.HangingPunctuation = MsoTriState.msoTrue; txtRng.Paragraphs(index).ParagraphFormat.SpaceBefore = 6; txtRng.Paragraphs(index).ParagraphFormat.SpaceAfter = 0; txtRng.Paragraphs(index).ParagraphFormat.SpaceWithin = (float)0.85; txtRng.Paragraphs(index).Parent.Ruler.Levels[index].FirstMargin = indentVal;//18 * (index - 1); txtRng.Paragraphs(index).Parent.Ruler.Levels[index].LeftMargin = 18 * (index); indentVal = indentVal + (float)0.47; } } catch (Exception err) { string errtext = err.Message; PPTAttribute.ErrorLog(errtext, "CreateBullet"); } }
public void setBulletTypeNone(int sldNum, string shpname) { PowerPoint.TextRange txtRng = ppApp.ActiveWindow.Selection.ShapeRange[1].TextFrame.TextRange; //PowerPoint.TextRange txtRng = ActivePPT.Slides[sldNum].Shapes[shpname].TextFrame.TextRange; //var paragraphs = txtRng.Paragraphs(-1, -1); for (int index = 1; index <= txtRng.Paragraphs().Count; index++) { txtRng.Paragraphs(index).ParagraphFormat.Bullet.Type = PowerPoint.PpBulletType.ppBulletNone; txtRng.Paragraphs(index).IndentLevel = 1; } }
public void setBulletImage(int sldNum, string shpname) { PowerPoint.TextRange txtRng = ppApp.ActiveWindow.Selection.ShapeRange[1].TextFrame.TextRange; //PowerPoint.TextRange txtRng = ActivePPT.Slides[sldNum].Shapes[shpname].TextFrame.TextRange; //var paragraphs = txtRng.Paragraphs(-1, -1); char myCharacter = (char)132; for (int index = 1; index <= txtRng.Paragraphs().Count; index++) { if (txtRng.Paragraphs(index).IndentLevel == 1) { txtRng.Paragraphs(index).ParagraphFormat.Bullet.Character = myCharacter; txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Color.RGB = System.Drawing.Color.FromArgb(78, 204, 124).ToArgb(); txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Size = (float)10.84; txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Name = "Wingdings 3"; txtRng.Paragraphs(index).Font.Color.RGB = System.Drawing.Color.FromArgb(57, 42, 30).ToArgb(); txtRng.Paragraphs(index).Font.Size = 12; txtRng.Paragraphs(index).Font.Name = "Corbel"; } else if (txtRng.Paragraphs(index).IndentLevel == 2) { txtRng.Paragraphs(index).ParagraphFormat.Bullet.Character = 167; txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Color.RGB = System.Drawing.Color.FromArgb(78, 204, 124).ToArgb(); txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Size = (float)11; txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Name = "Wingdings"; txtRng.Paragraphs(index).Font.Color.RGB = System.Drawing.Color.FromArgb(57, 42, 30).ToArgb(); txtRng.Paragraphs(index).Font.Size = 11; txtRng.Paragraphs(index).Font.Name = "Corbel"; } else if (txtRng.Paragraphs(index).IndentLevel == 3) { txtRng.Paragraphs(index).ParagraphFormat.Bullet.Character = 2013; txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Color.RGB = System.Drawing.Color.FromArgb(78, 204, 124).ToArgb(); txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Size = (float)11; txtRng.Paragraphs(index).ParagraphFormat.Bullet.Font.Name = "Corbel"; txtRng.Paragraphs(index).Font.Color.RGB = System.Drawing.Color.FromArgb(57, 42, 30).ToArgb(); txtRng.Paragraphs(index).Font.Size = 11; txtRng.Paragraphs(index).Font.Name = "Corbel"; } } }