Esempio n. 1
0
        private Worksheet SetCustomColumnWidths(string modelName, Worksheet workSheet)
        {
            uint colIndex = 0;
            int  width    = 0;

            foreach (ExportModelConfiguration config in exportConfig.OrderBy(c => c.Order))
            {
                colIndex++;
                width = 0;
                switch (modelName)
                {
                case ("OrderLine"):
                    width = OrderLine.SetWidths(config, width);
                    break;

                case ("ShoppingCartItem"):
                    width = ShoppingCartItem.SetWidths(config, width);
                    break;

                case ("InvoiceItemModel"):
                    width = InvoiceItemModel.SetWidths(config, width);
                    break;

                case ("Product"):
                    width = Product.SetWidths(config, width);
                    break;

                case ("Order"):
                    width = Order.SetWidths(config, width);
                    break;

                case ("ItemUsageReportItemModel"):
                    width = ItemUsageReportItemModel.SetWidths(config, width);
                    break;

                case ("InvoiceModel"):
                    width = InvoiceModel.SetWidths(config, width);
                    break;

                case ("ListItemModel"):
                    width = ListItemModel.SetWidths(config, width);
                    break;
                }

                if (width > 0)
                {
                    OpenXmlSpreadsheetUtilities.SetColumnWidth(workSheet, colIndex, width);
                }
            }
            return(workSheet);
        }