Exemplo n.º 1
0
        private void Write(int col, int row, string data)
        {
            Sheet.PrepareRow(col, row);

            Sheet.Write(data);

            Sheet.CurrentCol = col;
            Sheet.CurrentRow = row;
        }
Exemplo n.º 2
0
        public void Write(string value, int col, int row, DataType dataType = DataType.Text)
        {
            Sheet.PrepareRow(col, row);

            var data = GetCellData(value, col, row, dataType);

            Sheet.Write(data);

            Sheet.CurrentCol = col;
            Sheet.CurrentRow = row;
        }
Exemplo n.º 3
0
        protected internal void StartSheets()
        {
            Sheet.TextWriter = new StreamWriter($"{TempOutputPath}/xl/worksheets/sheet1.xml", false);

            Sheet.Write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
                        "<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x14ac xr xr2 xr3\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\" xmlns:xr=\"http://schemas.microsoft.com/office/spreadsheetml/2014/revision\" xmlns:xr2=\"http://schemas.microsoft.com/office/spreadsheetml/2015/revision2\" xmlns:xr3=\"http://schemas.microsoft.com/office/spreadsheetml/2016/revision3\" xr:uid=\"{{EA47BE14-E914-42F7-BE8E-AEEE5780E9D7}}\">" +
                        "<dimension ref=\"A1\"/>" +
                        "<sheetViews><sheetView tabSelected=\"1\" workbookViewId=\"0\"/></sheetViews>" +
                        "<sheetFormatPr defaultRowHeight=\"15\" x14ac:dyDescent=\"0.25\"/>");

            //write column definition
            if (Sheet.ColumnsWidth != null && Sheet.ColumnsWidth.Any())
            {
                Sheet.Write("<cols>");
                for (var i = 0; i < Sheet.ColumnsWidth.Count; i++)
                {
                    Sheet.Write(GetExcelColumnDefinition(Sheet.ColumnsWidth[i].ToString(CultureInfo.InvariantCulture), i + 1));
                }
                Sheet.Write("</cols>");
            }

            Sheet.Write("<sheetData>");
        }