Пример #1
0
        /// <summary>
        /// Processes the column of the output document as double column.
        /// </summary>
        /// <param name="sheetXml">Input sheet xml.</param>
        /// <param name="sheet">Worksheet to operate on.</param>
        /// <param name="startingRow">Row number to start.</param>
        /// <param name="columnIndex">1-based index of the column.</param>
        /// <param name="columnName">Name of the column.</param>
        private static void ProcessDoubleColumn(XElement sheetXml, Worksheet sheet, int startingRow, int columnIndex, string columnName)
        {
            MakoPrintXls.WriteTableHeader(sheetXml, sheet, startingRow, columnIndex, columnName);

            var items = sheetXml.Element("table").Element("items").Elements();

            XElement configElement = sheetXml.Element("table").Element("configuration").Element(columnName);

            int i = 1;

            foreach (XElement item in items)
            {
                if (item.Element(columnName) != null)
                {
                    Cell c = MakoPrintXls.CreateNewItemCell(sheet, startingRow + i++, columnIndex, configElement, item.Element(columnName));

                    if (item.Element(columnName).Value.Length > 0)
                    {
                        c.Value = Convert.ToDouble(item.Element(columnName).Value, CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        c.Value = null;
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Processes the column of the output document as autonumbering column.
        /// </summary>
        /// <param name="sheetXml">Input sheet xml.</param>
        /// <param name="sheet">Worksheet to operate on.</param>
        /// <param name="startingRow">Row number to start.</param>
        /// <param name="columnIndex">1-based index of the column.</param>
        /// <param name="columnName">Name of the column.</param>
        private static void ProcessAutonumberColumn(XElement sheetXml, Worksheet sheet, int startingRow, int columnIndex, string columnName)
        {
            MakoPrintXls.WriteTableHeader(sheetXml, sheet, startingRow, columnIndex, columnName);

            var items = sheetXml.Element("table").Element("items").Elements();

            XElement configElement = sheetXml.Element("table").Element("configuration").Element(columnName);

            int i = 1;

            foreach (XElement item in items)
            {
                Cell c = MakoPrintXls.CreateNewItemCell(sheet, startingRow + i, columnIndex, configElement, item);
                c.Value = i++;
            }
        }