예제 #1
0
 /// <summary>
 /// 设置页面为标准A4公文样式
 /// </summary>
 private void SetA4PageSetup()
 {
     OWordApplic.ActiveDocument.PageSetup.TopMargin = OWordApplic.CentimetersToPoints(3.7f);
     //oWordApplic.ActiveDocument.PageSetup.BottomMargin = oWordApplic.CentimetersToPoints(1f);
     OWordApplic.ActiveDocument.PageSetup.LeftMargin  = OWordApplic.CentimetersToPoints(2.8f);
     OWordApplic.ActiveDocument.PageSetup.RightMargin = OWordApplic.CentimetersToPoints(2.6f);
     //oWordApplic.ActiveDocument.PageSetup.HeaderDistance = oWordApplic.CentimetersToPoints(2.5f);
     //oWordApplic.ActiveDocument.PageSetup.FooterDistance = oWordApplic.CentimetersToPoints(1f);
     OWordApplic.ActiveDocument.PageSetup.PageWidth  = OWordApplic.CentimetersToPoints(21f);
     OWordApplic.ActiveDocument.PageSetup.PageHeight = OWordApplic.CentimetersToPoints(29.7f);
 }
예제 #2
0
        public void InsertLine(float left, float top, float width, float weight, int r, int g, int b)
        {
            //SetFontColor("red");
            //SetAlignment("Center");
            object Anchor = OWordApplic.Selection.Range;
            //int pLeft = 0, pTop = 0, pWidth = 0, pHeight = 0;
            //oWordApplic.ActiveWindow.GetPoint(out pLeft, out pTop, out pWidth, out pHeight,missing);
            //MessageBox.Show(pLeft + "," + pTop + "," + pWidth + "," + pHeight);
            object rep = false;

            //left += oWordApplic.ActiveDocument.PageSetup.LeftMargin;
            left  = OWordApplic.CentimetersToPoints(left);
            top   = OWordApplic.CentimetersToPoints(top);
            width = OWordApplic.CentimetersToPoints(width);
            Word.Shape s = OWordApplic.ActiveDocument.Shapes.AddLine(0, top, width, top, ref Anchor);
            s.Line.ForeColor.RGB = RGB(r, g, b);
            s.Line.Visible       = Microsoft.Office.Core.MsoTriState.msoTrue;
            s.Line.Style         = Microsoft.Office.Core.MsoLineStyle.msoLineSingle;
            s.Line.Weight        = weight;
        }