Exemplo n.º 1
0
        internal static CssDeclaration ToCss(this ExcelStyle excelStyle)
        {
            var css = new CssDeclaration();

            css["text-align"]       = excelStyle.HorizontalAlignment.ToCssProperty();
            css["background-color"] = excelStyle.Fill.BackgroundColor.ToHexCode();
            css.Update(excelStyle.Font.ToCss());
            css.Update(excelStyle.Border.ToCss());
            return(css);
        }
Exemplo n.º 2
0
        internal static CssDeclaration ToCss(this ExcelStyle excelStyle)
        {
            var css = new CssDeclaration();

            css["text-align"]       = excelStyle.HorizontalAlignment.ToCssProperty();
            css["background-color"] = excelStyle.Fill.BackgroundColor.ToHexCode();
            css["overflow"]         = excelStyle.HorizontalAlignment == ExcelHorizontalAlignment.Fill ? "hidden" : null;
            css["white-space"]      = excelStyle.WrapText ? "normal" : null;
            css.Update(excelStyle.Font.ToCss());
            css.Update(excelStyle.Border.ToCss());
            return(css);
        }
Exemplo n.º 3
0
        internal static CssDeclaration ToCss(this ExcelRow excelRow)
        {
            var css = new CssDeclaration();

            css["height"] = excelRow.Height + "px";

            css.Update(excelRow.Style.ToCss());

            return(css);
        }
Exemplo n.º 4
0
        internal static CssDeclaration ToCss(this ExcelStyle excelStyle, bool isLastRow, bool isLastColumn, bool isMerged)
        {
            var css = new CssDeclaration();

            css["text-align"]       = excelStyle.HorizontalAlignment.ToCssProperty();
            css["background-color"] = excelStyle.Fill.BackgroundColor.ToHexCode();
            css["overflow"]         = excelStyle.HorizontalAlignment == ExcelHorizontalAlignment.Fill ? "hidden" : null;
            css["padding-left"]     = "5px";
            css["padding-right"]    = "5px";

            if (excelStyle.Indent > 0)
            {
                css["padding-left"] = $"{excelStyle.Indent * 10}px";
            }

            css.Update(excelStyle.Font.ToCss());
            css.Update(excelStyle.Border.ToCss(isLastRow, isLastColumn, isMerged));
            return(css);
        }
Exemplo n.º 5
0
        internal static CssDeclaration ToCss(this ExcelRange excelRange)
        {
            var css = new CssDeclaration();

            if (excelRange.Columns == 1 && excelRange.Rows == 1)
            {
                var excelColumn = excelRange.Worksheet.Column(excelRange.Start.Column);

                css["max-width"] = excelColumn.Width + "em";
                css["width"]     = excelColumn.Width + "em";
                css.Update(excelRange.Style.ToCss());
            }
            return(css);
        }
Exemplo n.º 6
0
        internal static CssDeclaration ToCss(this ExcelRange excelRange)
        {
            var css = new CssDeclaration();

            if (excelRange.Columns == 1 && excelRange.Rows == 1)
            {
                var excelColumn = excelRange.Worksheet.Column(excelRange.Start.Column);

                css["max-width"] = excelColumn.Width + "em";
                css["width"]     = excelColumn.Width + "em";
                css["overflow"]  = excelRange.Worksheet.Cells[excelRange.End.Row, excelRange.End.Column + 1].Value != null ? "hidden" : null;

                css.Update(excelRange.Style.ToCss());
            }
            return(css);
        }
Exemplo n.º 7
0
        internal static CssDeclaration ToCss(this ExcelRange excelRange)
        {
            var css = new CssDeclaration();

            if (excelRange.Columns == 1 && excelRange.Rows == 1)
            {
                //var excelColumn = excelRange.Worksheet.Column(excelRange.Start.Column);

                //the tables ignore these width anyways
                //css["max-width"] = excelColumn.Width + "em";
                //css["width"] = excelColumn.Width + "em";
                css["overflow"] = excelRange.Worksheet.Cells[excelRange.End.Row, excelRange.End.Column + 1].Value != null ? "hidden" : null;

                css.Update(excelRange.Style.ToCss(excelRange.Worksheet.Dimension.Rows == excelRange.End.Row, excelRange.Worksheet.Dimension.Columns == excelRange.End.Column, excelRange.Merge));
            }
            return(css);
        }