Esempio n. 1
0
 public BorderInfo(MSWord.WdBorderType type, MSWord.WdLineStyle style, MSWord.WdLineWidth width, MSWord.WdColor color)
 {
     m_type  = type;
     m_style = style;
     m_width = width;
     m_color = color;
 }
Esempio n. 2
0
 /// <summary>
 /// Establece el estilo de la arista de una celda.
 /// </summary>
 /// <param name="cell">Celda a formatear.</param>
 /// <param name="style">Estilo de la línea.</param>
 /// <param name="borderType">Arista a colorear.</param>
 /// <param name="color">Color de la línea.</param>
 private void SetCellBorder(Word.Cell cell, Word.WdLineStyle style = Word.WdLineStyle.wdLineStyleSingle, Word.WdBorderType borderType = Word.WdBorderType.wdBorderBottom, Word.WdColor color = Word.WdColor.wdColorBlack)
 {
     Word.Border border = cell.Borders[borderType];
     border.Visible   = true;
     border.LineStyle = style;
     border.LineWidth = Word.WdLineWidth.wdLineWidth050pt;
     border.Color     = color;
 }
Esempio n. 3
0
        public static MSWord.Style CreateTableStyle(ref MSWord.Document wdDoc)
        {
            MSWord.WdBorderType verticalBorder = MSWord.WdBorderType.wdBorderVertical;
            MSWord.WdBorderType leftBorder     = MSWord.WdBorderType.wdBorderLeft;
            MSWord.WdBorderType rightBorder    = MSWord.WdBorderType.wdBorderRight;
            MSWord.WdBorderType topBorder      = MSWord.WdBorderType.wdBorderTop;

            MSWord.WdLineStyle doubleBorder = MSWord.WdLineStyle.wdLineStyleDouble;
            MSWord.WdLineStyle singleBorder = MSWord.WdLineStyle.wdLineStyleSingle;

            MSWord.WdTextureIndex noTexture = MSWord.WdTextureIndex.wdTextureNone;
            MSWord.WdColor        gray10    = MSWord.WdColor.wdColorGray10;
            MSWord.WdColor        gray70    = MSWord.WdColor.wdColorGray70;
            MSWord.WdColorIndex   white     = MSWord.WdColorIndex.wdWhite;

            object styleTypeTable = MSWord.WdStyleType.wdStyleTypeTable;

            MSWord.Style styl = wdDoc.Styles.Add("New Table Style", ref styleTypeTable);

            styl.Font.Name            = "Arial";
            styl.Font.Size            = 11;
            styl.Table.Borders.Enable = 1;

            MSWord.ConditionalStyle evenRowBanding = styl.Table.Condition(MSWord.WdConditionCode.wdEvenRowBanding);
            evenRowBanding.Shading.Texture = noTexture;
            evenRowBanding.Shading.BackgroundPatternColor = gray10;
            // Borders have to be set specifically for every condition.
            evenRowBanding.Borders[leftBorder].LineStyle     = doubleBorder;
            evenRowBanding.Borders[rightBorder].LineStyle    = doubleBorder;
            evenRowBanding.Borders[verticalBorder].LineStyle = singleBorder;

            MSWord.ConditionalStyle firstRow = styl.Table.Condition(MSWord.WdConditionCode.wdFirstRow);
            firstRow.Shading.BackgroundPatternColor = gray70;
            firstRow.Borders[leftBorder].LineStyle  = doubleBorder;
            firstRow.Borders[topBorder].LineStyle   = doubleBorder;
            firstRow.Borders[rightBorder].LineStyle = doubleBorder;
            firstRow.Font.Size       = 14;
            firstRow.Font.ColorIndex = white;
            firstRow.Font.Bold       = 1;

            // Set the number of rows to include in a "band".
            styl.Table.RowStripe = 1;
            return(styl);
        }