コード例 #1
0
        public static void AddTableCellProperties(TableRow tableRow,
                TableCell tableCell, bool toppest, bool bottomest,
                bool leftest, bool rightest, StringBuilder style)
        {
            style.Append("width:" + (tableCell.GetWidth() / TWIPS_PER_INCH) + "in;");
            style.Append("padding-start:" + (tableRow.GetGapHalf() / TWIPS_PER_INCH) + "in;");
            style.Append("padding-end:" + (tableRow.GetGapHalf() / TWIPS_PER_INCH) + "in;");

            BorderCode top = tableCell.GetBrcTop() != null
                    && tableCell.GetBrcTop().BorderType != 0 ? tableCell
                    .GetBrcTop() : toppest ? tableRow.GetTopBorder() : tableRow
                    .GetHorizontalBorder();
            BorderCode bottom = tableCell.GetBrcBottom() != null
                    && tableCell.GetBrcBottom().BorderType != 0 ? tableCell
                    .GetBrcBottom() : bottomest ? tableRow.GetBottomBorder()
                    : tableRow.GetHorizontalBorder();

            BorderCode left = tableCell.GetBrcLeft() != null
                    && tableCell.GetBrcLeft().BorderType != 0 ? tableCell
                    .GetBrcLeft() : leftest ? tableRow.GetLeftBorder() : tableRow
                    .GetVerticalBorder();
            BorderCode right = tableCell.GetBrcRight() != null
                    && tableCell.GetBrcRight().BorderType != 0 ? tableCell
                    .GetBrcRight() : rightest ? tableRow.GetRightBorder()
                    : tableRow.GetVerticalBorder();

            AddBorder(bottom, "bottom", style);
            AddBorder(left, "left", style);
            AddBorder(right, "right", style);
            AddBorder(top, "top", style);
        }
コード例 #2
0
ファイル: WordToFoUtils.cs プロジェクト: ctddjyds/npoi
        public static void SetTableCellProperties(TableRow tableRow,
                TableCell tableCell, XmlElement XmlElement, bool toppest,
                bool bottomest, bool leftest, bool rightest)
        {
            XmlElement.SetAttribute("width", (tableCell.GetWidth() / TWIPS_PER_INCH)
                    + "in");
            XmlElement.SetAttribute("padding-start",
                    (tableRow.GetGapHalf() / TWIPS_PER_INCH) + "in");
            XmlElement.SetAttribute("padding-end",
                    (tableRow.GetGapHalf() / TWIPS_PER_INCH) + "in");

            BorderCode top = tableCell.GetBrcTop() != null
                    && tableCell.GetBrcTop().BorderType != 0 ? tableCell
                    .GetBrcTop() : toppest ? tableRow.GetTopBorder() : tableRow
                    .GetHorizontalBorder();
            BorderCode bottom = tableCell.GetBrcBottom() != null
                    && tableCell.GetBrcBottom().BorderType != 0 ? tableCell
                    .GetBrcBottom() : bottomest ? tableRow.GetBottomBorder()
                    : tableRow.GetHorizontalBorder();

            BorderCode left = tableCell.GetBrcLeft() != null
                    && tableCell.GetBrcLeft().BorderType != 0 ? tableCell
                    .GetBrcLeft() : leftest ? tableRow.GetLeftBorder() : tableRow
                    .GetVerticalBorder();
            BorderCode right = tableCell.GetBrcRight() != null
                    && tableCell.GetBrcRight().BorderType != 0 ? tableCell
                    .GetBrcRight() : rightest ? tableRow.GetRightBorder()
                    : tableRow.GetVerticalBorder();

            SetBorder(XmlElement, bottom, "bottom");
            SetBorder(XmlElement, left, "left");
            SetBorder(XmlElement, right, "right");
            SetBorder(XmlElement, top, "top");
        }