Ejemplo n.º 1
0
        public List <ParsedTables> ParseTablesFirstName()
        {
            List <ParsedTables> plist = new List <ParsedTables>(1);
            List <Table>        tList = new List <Table>(Content);

            for (int i = 0; i < tList.Count; i++)
            {
                ParsedTables pt = new ParsedTables(tList[i].FirstName);
                pt.Add(tList[i]);
                for (int j = i + 1; j < tList.Count; j++)
                {
                    if (tList[i].FirstName == tList[j].FirstName)
                    {
                        pt.Add(tList[j]);
                        tList.RemoveAt(j);
                        j--;
                    }
                }
                plist.Add(pt);
            }
            return(plist);
        }
Ejemplo n.º 2
0
        public List <ParsedTables> ParseTablesByDates()
        {
            List <Table> tList =
                new List <Table>(Content);
            List <ParsedTables> m_ParsedTables =
                new List <ParsedTables>(NumberOfIndividDates());

            for (int i = 0; i < tList.Count; i++)
            {
                ParsedTables parsedTables = new ParsedTables(tList[i].FirstName);
                parsedTables.Add(tList[i]);
                for (int j = i + 1; j < tList.Count; j++)
                {
                    if (tList[i].FirstName == tList[j].FirstName)
                    {
                        parsedTables.Add(tList[j]);
                        tList.RemoveAt(j);
                        j--;
                    }
                }
                m_ParsedTables.Add(parsedTables);
            }
            return(m_ParsedTables);
        }
Ejemplo n.º 3
0
Archivo: XL.cs Proyecto: vezone/FinApp
        public void GenerateExcelDatePage(string date, ParsedTables list)
        {
            //Basic
            m_WorkSheetCollection[m_WSCollectionIndex] =
                m_WorkBook.Worksheets.Add();
            m_WorkSheetCollection[m_WSCollectionIndex].Name = date;
            m_WorkSheetCollection[m_WSCollectionIndex].StandardWidth
                = 30;

            int RowToBegin    = 2;
            int ColumnToBegin = 1;

            for (int i = 0, j = 0; j < list.Count; j++, i = i + 3)
            {
                //grid
                var cells = m_WorkSheetCollection[m_WSCollectionIndex]
                            .get_Range($"{(char)('A' + RowToBegin - 2)}{1 + ColumnToBegin + i}",
                                       $"{(char)('B' + RowToBegin - 2)}{3 + ColumnToBegin + i}");
                cells.Borders[Excel.XlBordersIndex.xlInsideVertical].LineStyle
                    = Excel.XlLineStyle.xlContinuous; // внутренние вертикальные
                cells.Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle
                    = Excel.XlLineStyle.xlContinuous; // внутренние горизонтальные
                cells.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle
                    = Excel.XlLineStyle.xlContinuous; // верхняя внешняя
                cells.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle
                    = Excel.XlLineStyle.xlContinuous; // правая внешняя
                cells.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle
                    = Excel.XlLineStyle.xlContinuous; // левая внешняя
                cells.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle
                    = Excel.XlLineStyle.xlContinuous;

                //individ
                m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + RowToBegin, ColumnToBegin]
                .Font.Bold = true;
                m_WorkSheetCollection[m_WSCollectionIndex].Range[
                    m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + RowToBegin, ColumnToBegin],
                    m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + RowToBegin, ColumnToBegin + 1]
                ].Font.Size = 20;
                m_WorkSheetCollection[m_WSCollectionIndex].Range[
                    m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + RowToBegin, ColumnToBegin],
                    m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + RowToBegin, ColumnToBegin + 1]
                ].Merge();

                //Set Times New Roman to ALL
                m_WorkSheetCollection[m_WSCollectionIndex].Cells.HorizontalAlignment
                    = Excel.Constants.xlCenter;
                m_WorkSheetCollection[m_WSCollectionIndex].Cells.Font.Name
                    = "Times New Roman";
                m_WorkSheetCollection[m_WSCollectionIndex].Range[
                    m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + 3, ColumnToBegin],
                    m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + 4, ColumnToBegin + 1]
                ].Font.Size = 14;

                //Заголовок
                m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + RowToBegin, ColumnToBegin] =
                    list[j].SecondName;

                //Параметры
                m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + 3, ColumnToBegin] =
                    "кол-во";
                m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + 3, ColumnToBegin + 1] =
                    "стоимость";

                //Значения
                m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + 4, ColumnToBegin] =
                    list[j].Content.Count;
                m_WorkSheetCollection[m_WSCollectionIndex].Cells[i + 4, ColumnToBegin + 1] =
                    list[j].GetSummary();
            }

            m_WorkSheetCollection[m_WSCollectionIndex] = null;
            ++m_WSCollectionIndex;

            // Открываем созданный excel-файл
            m_ExcelApplication.Visible     = true;
            m_ExcelApplication.UserControl = true;
        }