private void modTextRange(MockTextRange2 tr) { if (tr.Text.Length == 0) { return; } if (tr.Text[0] == '`') { // first level bullet tr.ParagraphFormat.Bullet.Type = MsoBulletType.msoBulletUnnumbered; tr.ParagraphFormat.Bullet.Character = 167; // square tr.ParagraphFormat.IndentLevel = 1; tr.Text = tr.Text.Substring(1); } else if (tr.Text[0] == '^') { // second level bullet tr.ParagraphFormat.Bullet.Type = MsoBulletType.msoBulletUnnumbered; tr.ParagraphFormat.Bullet.Character = 167; // square tr.ParagraphFormat.IndentLevel = 2; tr.ParagraphFormat.LeftIndent = tr.ParagraphFormat.LeftIndent * 2; tr.ParagraphFormat.FirstLineIndent = tr.ParagraphFormat.FirstLineIndent * 2; tr.Text = tr.Text.Substring(1); } else if (tr.Text[0] == '*') { // third level bullet tr.ParagraphFormat.Bullet.Type = MsoBulletType.msoBulletUnnumbered; tr.ParagraphFormat.Bullet.Character = 167; // square tr.ParagraphFormat.IndentLevel = 3; tr.ParagraphFormat.LeftIndent = tr.ParagraphFormat.LeftIndent * 2; tr.ParagraphFormat.FirstLineIndent = tr.ParagraphFormat.FirstLineIndent * 2; tr.Text = tr.Text.Substring(1); } else if (tr.Text[0] == '%' || tr.Text[0] == '@') { // third level bullet tr.ParagraphFormat.Bullet.Type = MsoBulletType.msoBulletNumbered; if (tr.Text[0] == '@') { MockBulletFormat2 bull = (MockBulletFormat2)tr.ParagraphFormat.Bullet; bull.number = 2; } tr.ParagraphFormat.IndentLevel = 1; tr.ParagraphFormat.LeftIndent = tr.ParagraphFormat.LeftIndent; tr.ParagraphFormat.FirstLineIndent = tr.ParagraphFormat.FirstLineIndent; tr.Text = tr.Text.Substring(1); } }
private TextRange2 getLinesOrPgs(char splitChar) { List <TextRange2> result = new List <TextRange2>(); this.trList = null; foreach (String t in this.text.Split(splitChar).ToList <String>()) { MockTextRange2 tr = MockHelper.DeepClone(this); tr.Text = t; this.modTextRange(tr); result.Add(tr); } this.trList = result; return(MockHelper.DeepClone(this)); }
private void modTextRange(MockTextRange2 tr) { if(tr.Text.Length == 0) return; if(tr.Text[0]=='`') { // first level bullet tr.ParagraphFormat.Bullet.Type = MsoBulletType.msoBulletUnnumbered; tr.ParagraphFormat.Bullet.Character = 167; // square tr.ParagraphFormat.IndentLevel = 1; tr.Text = tr.Text.Substring(1); } else if(tr.Text[0] == '^') { // second level bullet tr.ParagraphFormat.Bullet.Type = MsoBulletType.msoBulletUnnumbered; tr.ParagraphFormat.Bullet.Character = 167; // square tr.ParagraphFormat.IndentLevel = 2; tr.ParagraphFormat.LeftIndent = tr.ParagraphFormat.LeftIndent * 2; tr.ParagraphFormat.FirstLineIndent = tr.ParagraphFormat.FirstLineIndent * 2; tr.Text = tr.Text.Substring(1); } else if(tr.Text[0] == '*') { // third level bullet tr.ParagraphFormat.Bullet.Type = MsoBulletType.msoBulletUnnumbered; tr.ParagraphFormat.Bullet.Character = 167; // square tr.ParagraphFormat.IndentLevel = 3; tr.ParagraphFormat.LeftIndent = tr.ParagraphFormat.LeftIndent * 2; tr.ParagraphFormat.FirstLineIndent = tr.ParagraphFormat.FirstLineIndent * 2; tr.Text = tr.Text.Substring(1); } else if(tr.Text[0] == '%' || tr.Text[0] == '@') { // third level bullet tr.ParagraphFormat.Bullet.Type = MsoBulletType.msoBulletNumbered; if(tr.Text[0] == '@') { MockBulletFormat2 bull = (MockBulletFormat2)tr.ParagraphFormat.Bullet; bull.number = 2; } tr.ParagraphFormat.IndentLevel = 1; tr.ParagraphFormat.LeftIndent = tr.ParagraphFormat.LeftIndent; tr.ParagraphFormat.FirstLineIndent = tr.ParagraphFormat.FirstLineIndent; tr.Text = tr.Text.Substring(1); } }