Exemple #1
0
        private void WriteText(double value, CellIndex startCellIndex, int cellCount, Alignment alignment)
        {
            var cultureInfo = CultureInfo.GetCultureInfo("en-US");
            var text        = value.ToString("F2", cultureInfo);

            WriteText(text, startCellIndex, cellCount, alignment);
        }
Exemple #2
0
        private void WriteToCell(double value, CellIndex cellIndex)
        {
            var cultureInfo = CultureInfo.GetCultureInfo("en-US");
            var text        = value.ToString(cultureInfo);

            WriteToCell(text, cellIndex);
        }
Exemple #3
0
        private void WriteText(string text, CellIndex startCellIndex, int cellCount, Alignment alignment)
        {
            var spaceCount = Math.Max(cellCount - text.Length, 0);
            var spaces     = Enumerable.Repeat(' ', spaceCount);
            var textChars  = text.ToCharArray();

            var chars = alignment == Alignment.Left
                ? Enumerable.Concat(textChars, spaces)
                        .ToList()
                : Enumerable.Concat(spaces, textChars)
                        .ToList();

            for (int i = 0; i < chars.Count; i++)
            {
                var symbol      = chars[i];
                int rowIndex    = startCellIndex.Row;
                int columnIndex = startCellIndex.Column + i;
                _workSheet.Cells[rowIndex, columnIndex] = symbol.ToString();
            }
        }
Exemple #4
0
 private void WriteText(int value, CellIndex startCellIndex, int cellCount, Alignment alignment)
 {
     WriteText(value.ToString(), startCellIndex, cellCount, alignment);
 }
Exemple #5
0
 private void WriteToCell(string text, CellIndex cellIndex)
 {
     _workSheet.Cells[cellIndex.Row, cellIndex.Column] = text;
 }