Ejemplo n.º 1
0
            public ExcelTable(ref ExcelColumns columns)
            {
                _columns = columns;
                _table = new ExcelObject("Table");

                if (_table != null)
                {
                    int _column_count = columns.Count();
                    for (int index = 0; index < _column_count; index++)
                    {
                        ExcelObject _value = columns.GetColumnObject(index);
                        _table.AddObject(-(index + 1), ref _value);
                    };
                };

                _rows = new SortedList();
            }
Ejemplo n.º 2
0
            public ExcelRow AddHeader(ref ExcelTable excel_table, ref ExcelColumns exist_columns)
            {
                ExcelRow result = null;

                if ((excel_table != null) && (exist_columns != null))
                {
                    int column_count = exist_columns.Count();
                    if (column_count > 0)
                    {
                        result = AddRow(0, ref excel_table);
                        if (result != null)
                        {
                            string column_name = string.Empty;
                            string column_alias = string.Empty;
                            for (int index = 0; index < column_count; index++)
                            {
                                ExcelObject _object = exist_columns.GetColumnObject(index);
                                if (_object != null)
                                {
                                    column_name = _object.GetPropertyValue("Name");
                                    column_alias = _object.GetPropertyValue("Alias");
                                };

                                if (column_name.Length > 0)
                                    result.SetHeaderValue(column_name, column_alias);
                            };
                        };
                    };
                };

                return result;
            }