예제 #1
0
        public void CreateXlsDoc()
        {
            ExcelHandler excelHndlr = new ExcelHandler();

            string codeBase = AppContext.BaseDirectory;
            int    fileName = 0;
            string outputFile;

            do
            {
                outputFile = Path.Combine(codeBase, $"{fileName++}.xlsx");
            } while (File.Exists(outputFile));

            const int ASCII_ALPHAS_OFFSET = 65;

            string[,] data = new string[10, 16];
            for (int i = 0; i < data.GetLength(0); i++)
            {
                for (int j = 0; j < data.GetLength(1); j++)
                {
                    data[i, j] = Convert.ToChar(ASCII_ALPHAS_OFFSET + j).ToString();
                }
            }

            excelHndlr.CreateXlsDoc(outputFile, $"A{2}", $"P{10}", data);
        }
예제 #2
0
        private void btnGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var data = htmlHandler.ReadReportData(txtBoxToHtmlReport.Text);

                using (xlsHanlder)
                    xlsHanlder.CreateXlsDoc(txtBoxToHtmlReport.Text, "A2", $"P{data.GetLength(0)}", data);
            }
            catch (Exception ex)
            {
                RaiseErorrMessageBox("Report generation is failed. Check if you have specified the folder with html data.", "Failure");
            }
        }