Beispiel #1
0
 //在WORD中显示当前的item
 void showSomething(ItemObject obj)
 {
     switch (obj.type)
     {
         case WordType.Paragraph:
             (obj.o as Word.Paragraph).Range.Select();
             break;
         case WordType.Table:
             (obj.o as Word.Table).Select();
             break;
         case WordType.Cell:
             (obj.o as Word.Cell).Select();
             break;
     }
 }
Beispiel #2
0
 TreeNode AddNode(ItemObject itm)
 {
     TreeNode tr = new TreeNode();
     tr.Tag = itm;
     tr.Text = itm.name;
     TopElement().Nodes.Add(tr);
     return tr;
 }
Beispiel #3
0
 //列出可以成为考点的属性
 void listProperty(ItemObject obj)
 {
     checkedListBox1.Items.Clear();
     displayInfo.Clear();
     switch (obj.type)
     {
         case WordType.Paragraph:
             Word.Paragraph p = (Word.Paragraph)obj.o;
             displayInfo.Add(new DisplayObject("文字", "Text", p.Range.Text));
             displayInfo.Add(new DisplayObject("对齐方式", "Alignment", p.Alignment));
             displayInfo.Add(new DisplayObject("首行/悬挂缩进", "CharacterUnitFirstLineIndent", p.CharacterUnitFirstLineIndent));
             displayInfo.Add(new DisplayObject("左缩进", "CharacterUnitLeftIndent", p.CharacterUnitLeftIndent));
             displayInfo.Add(new DisplayObject("右缩进", "CharacterUnitRightIndent", p.CharacterUnitRightIndent));
             break;
         case WordType.Table:
             Word.Table t = (Word.Table)obj.o;
             displayInfo.Add(new DisplayObject("行数", "Rows", t.Rows.Count));
             displayInfo.Add(new DisplayObject("列数", "Columns", t.Columns.Count));
             break;
         case WordType.Cell:
             Word.Cell cell = (Word.Cell)obj.o;
             displayInfo.Add(new DisplayObject("文字", "Text", cell.Range.Text));
             displayInfo.Add(new DisplayObject("高度", "Height", cell.Height));
             displayInfo.Add(new DisplayObject("宽度", "Width", cell.Width));
             //displayInfo.Add(new DisplayObject("行索引", "RowIndex", cell.RowIndex));
             //displayInfo.Add(new DisplayObject("列索引", "ColumnIndex", cell.ColumnIndex));
             break;
         default:
             break;
     }
     foreach (DisplayObject d in displayInfo)
         checkedListBox1.Items.Add(d.ToString());
 }
Beispiel #4
0
 //列出可以成为考点的属性
 void listProperty(ItemObject obj)
 {
     checkedListBox1.Items.Clear();
     displayInfo.Clear();
     switch (obj.type)
     {
         case WordType.Indent:
             #region 缩进
             Word.Paragraph p = (Word.Paragraph)obj.o;
             displayInfo.Add(new DisplayObject("对齐方式", "Alignment", p.Alignment));
             displayInfo.Add(new DisplayObject("首行/悬挂缩进", "CharacterUnitFirstLineIndent", p.CharacterUnitFirstLineIndent));
             displayInfo.Add(new DisplayObject("左缩进", "CharacterUnitLeftIndent", p.CharacterUnitLeftIndent));
             displayInfo.Add(new DisplayObject("右缩进", "CharacterUnitRightIndent", p.CharacterUnitRightIndent));
             displayInfo.Add(new DisplayObject("段前间距", "LineUnitBefore", p.LineUnitBefore));
             displayInfo.Add(new DisplayObject("段后间距", "LineUnitAfter", p.LineUnitAfter));
             displayInfo.Add(new DisplayObject("行距规则", "LineSpacingRule", p.LineSpacingRule));
             displayInfo.Add(new DisplayObject("行距设置值", "LineSpacing", p.LineSpacing));
             #endregion
             break;
         case WordType.Font:
             #region 字体
             Word.Range range = (Word.Range)obj.o;
             displayInfo.Add(new DisplayObject("文字", "Text", range.Text));
             displayInfo.Add(new DisplayObject("字号", "FontSize", range.Font.Size));
             displayInfo.Add(new DisplayObject("字体", "FontName", range.Font.Name));
             displayInfo.Add(new DisplayObject("粗体", "Bold", range.Font.Bold));
             displayInfo.Add(new DisplayObject("斜体", "Italic", range.Font.Italic));
             displayInfo.Add(new DisplayObject("下划线", "Underline", range.Font.Underline));
             displayInfo.Add(new DisplayObject("下划线颜色", "UnderlineColor", range.Font.UnderlineColor));
             displayInfo.Add(new DisplayObject("文字颜色", "ForeColor", range.Font.Color));
             displayInfo.Add(new DisplayObject("突出显示颜色", "HighLightColor", range.HighlightColorIndex));
             displayInfo.Add(new DisplayObject("上标", "Superscript", range.Font.Superscript));
             displayInfo.Add(new DisplayObject("下标", "Subscript", range.Font.Subscript));
             displayInfo.Add(new DisplayObject("字符间距值", "Spacing", range.Font.Spacing));
             displayInfo.Add(new DisplayObject("动态效果", "Animation", range.Font.Animation));
             displayInfo.Add(new DisplayObject("底纹颜色", "BackgroundPatternColor", range.Shading.BackgroundPatternColor));
             #endregion
             break;
         case WordType.DropCap:
             #region 首字下沉
             Word.DropCap dc = (Word.DropCap)obj.o;
             displayInfo.Add(new DisplayObject("首字下沉位置", "Position", dc.Position));
             displayInfo.Add(new DisplayObject("首字下沉字体", "DcFontName", dc.FontName));
             displayInfo.Add(new DisplayObject("首字下沉行数", "LinesToDrop", dc.LinesToDrop));
             displayInfo.Add(new DisplayObject("与正文距离", "DistanceFromText", dc.DistanceFromText));
             #endregion
             break;
         case WordType.TextColumns:
             #region  分栏与栏宽
             Word.TextColumns tc = (Word.TextColumns)obj.o;
             displayInfo.Add(new DisplayObject("分栏数", "TextColumnsCount", tc.Count));
             displayInfo.Add(new DisplayObject("栏宽", "TextColumnsWidth", tc.Width));
             //栏宽不为99999999 表示栏宽相等  否则表示栏宽不等
             displayInfo.Add(new DisplayObject("栏间间隔", "TextColumnsSpacing", tc.Spacing));
             displayInfo.Add(new DisplayObject("是否有分隔符", "TextColumnsLineBetween", tc.LineBetween));
             //-1表示有 0表示没有
             #endregion
             break;
         case WordType.Textbox:
             #region 文本框
             Word.TextFrame tf = ((Word.Shape)obj.o).TextFrame;
             displayInfo.Add(new DisplayObject("文字", "Text", tf.TextRange.Text));
             displayInfo.Add(new DisplayObject("方向", "Orientation", tf.Orientation));
             displayInfo.Add(new DisplayObject("字体", "FontName", tf.TextRange.Font.Name));
             displayInfo.Add(new DisplayObject("字号", "FontSize", tf.TextRange.Font.Size));
             displayInfo.Add(new DisplayObject("文字颜色", "ForeColor", tf.TextRange.Font.Color));
             displayInfo.Add(new DisplayObject("突出显示颜色", "HighLightColor", tf.TextRange.HighlightColorIndex));
             displayInfo.Add(new DisplayObject("字符间距值", "Spacing", tf.TextRange.Font.Spacing));
             displayInfo.Add(new DisplayObject("对齐方式", "Alignment", tf.TextRange.ParagraphFormat.Alignment));
             //Horizontal, Vertical, VerticalFarEast
             #endregion
             break;
         case WordType.Table:
             #region 表格
             Word.Table t = (Word.Table)obj.o;
             displayInfo.Add(new DisplayObject("行数", "Rows", t.Rows.Count));
             displayInfo.Add(new DisplayObject("列数", "Columns", t.Columns.Count));
             #endregion
             break;
         case WordType.Cell:
             #region 单元格
             Word.Cell cell = (Word.Cell)obj.o;
             displayInfo.Add(new DisplayObject("文字", "Text", cell.Range.Text));
             displayInfo.Add(new DisplayObject("高度", "Height", cell.Height));
             displayInfo.Add(new DisplayObject("宽度", "Width", cell.Width));
             //displayInfo.Add(new DisplayObject("行索引", "RowIndex", cell.RowIndex));
             //displayInfo.Add(new DisplayObject("列索引", "ColumnIndex", cell.ColumnIndex));
             #endregion
             break;
         case WordType.PageSetup:
             #region 页面设置
             Word.PageSetup ps = (Word.PageSetup)obj.o;
             displayInfo.Add(new DisplayObject("页面上边距", "TopMargin", ps.TopMargin));
             displayInfo.Add(new DisplayObject("页面下边距", "BottomMargin", ps.BottomMargin));
             displayInfo.Add(new DisplayObject("页面左边距", "LeftMargin", ps.LeftMargin));
             displayInfo.Add(new DisplayObject("页面右边距", "RightMargin", ps.RightMargin));
             displayInfo.Add(new DisplayObject("页眉距边界", "HeaderDistance", ps.HeaderDistance));
             displayInfo.Add(new DisplayObject("页脚距边界", "FooterDistance", ps.FooterDistance));
             displayInfo.Add(new DisplayObject("页面方向", "Orientation", ps.Orientation));
             //页面方向  Landscape为横向 Protrait为纵向
             displayInfo.Add(new DisplayObject("装订线位置", "GutterPos", ps.GutterPos));
             //GutterPosLeft为左  GutterPosTop为上
             #endregion
             break;
         default:
             break;
     }
     foreach (DisplayObject d in displayInfo)
         checkedListBox1.Items.Add(d.ToString());
 }