Пример #1
0
 public void Copy(RelativeTo rt)
 {
     if (rt == null)
     {
         return;
     }
     horizontal = rt.horizontal;
     vertical   = rt.vertical;
 }
Пример #2
0
        public int SetCell(
            int font   = (int)FONT_STYLE.NORMAL,
            int fill   = (int)FILL_STYLE.NONE,
            int border = (int)BORDER_STYLE.NO_BORDER,
            int format = 0,
            HORIZONTAL_ALIGN horizontal = HORIZONTAL_ALIGN.LEFT,
            VERTICAL_ALIGN vertical     = VERTICAL_ALIGN.TOP, bool wrapText = true
            )
        {
            CellFormat cell = new CellFormat()
            {
                FontId         = (uint)font,
                FillId         = (uint)fill,
                BorderId       = (uint)border,
                FormatId       = (uint)0U,
                NumberFormatId = (uint)format,
                ApplyFill      = true
            };

            Alignment align = new Alignment()
            {
                WrapText = wrapText,
            };

            if (horizontal == HORIZONTAL_ALIGN.CENTER)
            {
                align.Horizontal = DocumentFormat.OpenXml.Spreadsheet.HorizontalAlignmentValues.Center;
            }
            if (horizontal == HORIZONTAL_ALIGN.RIGHT)
            {
                align.Horizontal = DocumentFormat.OpenXml.Spreadsheet.HorizontalAlignmentValues.Right;
            }

            if (vertical == VERTICAL_ALIGN.TOP)
            {
                align.Vertical = VerticalAlignmentValues.Top;
            }
            if (vertical == VERTICAL_ALIGN.CENTER)
            {
                align.Vertical = VerticalAlignmentValues.Center;
            }
            if (vertical == VERTICAL_ALIGN.BOTTOM)
            {
                align.Vertical = VerticalAlignmentValues.Bottom;
            }


            cell.Append(align);


            return(this.SetStyle <CellFormat>(cell));
        }
Пример #3
0
 public void Copy(RelativeTo rt)
 {
     if (rt == null)
         return;
     horizontal = rt.horizontal;
     vertical = rt.vertical;
 }