Exemplo n.º 1
0
 public static void CompleteFields(GOST table, int height, int width)
 {
     if (table.Position == 4)
     {
         int offset_width  = width - GetSortedSet(table.Columns).Last();
         int offset_height = height - GetSortedSet(table.Rows).Last();
         for (int i = 0; i < table.Fields.Count; ++i)
         {
             for (int j = 0; j < table.Fields[i].Count; ++j)
             {
                 table.Fields[i][j][0] += offset_height;
                 table.Fields[i][j][1] += offset_width;
                 table.Fields[i][j][2] += offset_height;
                 table.Fields[i][j][3] += offset_width;
             }
         }
     }
     else if (table.Position == 3)
     {
         int offset_height = height - GetSortedSet(table.Rows).Last();
         for (int i = 0; i < table.Fields.Count; ++i)
         {
             for (int j = 0; j < table.Fields[i].Count; ++j)
             {
                 table.Fields[i][j][0] += offset_height;
                 table.Fields[i][j][2] += offset_height;
             }
         }
     }
 }
 public void AddTable(GOST table)
 {
     if (Tables.Count == 0)
     {
         Tables.Add(table);
         Format      = table.Format;
         Orientation = table.Orientation;
         Columns     = new List <int[]>(table.Columns);
         Rows        = new List <int[]>(table.Rows);
         SetPageDimensions();
     }
     else
     {
         if (table.Position > 1)
         {
             XMLTools.CompleteFields(table, Height, Width);
             XMLTools.CreateNormalTable(table, Height, Width);
         }
         Tables.Add(table);
         if (table.Columns != null && table.Rows != null)
         {
             (Columns, Rows) = XMLTools.MergeTables(Columns, Rows, table.Columns, table.Rows);
         }
     }
 }
Exemplo n.º 3
0
        public static GOST LoadConfFile(string config)
        {
            GOST newGOST = JsonConvert.DeserializeObject <GOST>(config);

            newGOST.Data    = new List <List <string> >();
            newGOST.ElemCol = new ElementCollection();
            return(newGOST);
        }
Exemplo n.º 4
0
        public void LoadConfigs()
        {
            // Add table page(s)
            if (Table != GOST.Standarts.None)
            {
                for (int i = 0; i < GetTablePagesCount(Rvt.Data.ExportElements.Count, ConfFile.Lines[(int)Table]); ++i)
                {
                    WorkSheet newWS = AddWorkSheet(String.Format("Лист {0}", i + 1));
                    newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Table]));
                    if (Pages == 0)
                    {
                        // Add stamp to page
                        if (Stamp1 != GOST.Standarts.None)
                        {
                            newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Stamp1]));
                        }

                        // Add dop to page
                        if (Dop1 != GOST.Standarts.None)
                        {
                            newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Dop1]));
                        }
                    }
                    else
                    {
                        // Add stamp to page
                        if (Stamp2 != GOST.Standarts.None)
                        {
                            newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Stamp2]));
                        }

                        // Add dop to page
                        if (Dop2 != GOST.Standarts.None)
                        {
                            newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Dop2]));
                        }
                    }
                    Pages++;
                }
            }
            // Add title page
            if (Title != GOST.Standarts.None)
            {
                WorkSheet newWS = AddWorkSheet("Титульный лист");
                newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Title]));
            }
        }
Exemplo n.º 5
0
        public static void CreateNormalTable(GOST table, int height, int width)
        {
            // Init new notation arrays
            (List <int[]> col, List <int[]> row) = (new List <int[]>(), new List <int[]>());

            // Update columns
            if (table.Position == 4)
            {
                for (int i = 0; i < table.Columns.Count; ++i)
                {
                    if (table.Columns[i].Length == 1 && table.Columns[i][0] == 0)
                    {
                        col.Add(new int[] { width });
                        continue;
                    }
                    col.Add(new int[table.Columns[i].Length + 1]);
                    col.Last()[0] = width - table.Columns[i].Sum();
                    for (int j = 1; j < col.Last().Length; ++j)
                    {
                        col.Last()[j] = table.Columns[i][j - 1];
                    }
                }
            }
            if (table.Position == 3)
            {
                for (int i = 0; i < table.Columns.Count; ++i)
                {
                    if (table.Columns[i].Length == 1 && table.Columns[i][0] == 0)
                    {
                        col.Add(new int[] { width });
                        continue;
                    }
                    col.Add(new int[table.Columns[i].Length + 1]);
                    for (int j = 0; j < col.Last().Length - 1; ++j)
                    {
                        col.Last()[j] = table.Columns[i][j];
                    }
                    col.Last()[col.Last().Length - 1] = width - table.Columns[i].Sum();
                }
            }

            // Update rows
            if (table.Position == 3 || table.Position == 4)
            {
                for (int i = 0; i < table.Rows.Count; ++i)
                {
                    if (table.Rows[i].Length == 1 && table.Rows[i][0] == 0)
                    {
                        row.Add(new int[] { height });
                        continue;
                    }
                    row.Add(new int[table.Rows[i].Length + 1]);
                    row.Last()[0] = height - table.Rows[i].Sum();
                    for (int j = 1; j < row.Last().Length; ++j)
                    {
                        row.Last()[j] = table.Rows[i][j - 1];
                    }
                }
            }

            // Assign table arrays to new arrays
            (table.Columns, table.Rows) = (col, row);
        }