当前位置: 首页>>代码示例>>C#>>正文


C# IXLWorksheet.LastColumnUsed方法代码示例

本文整理汇总了C#中IXLWorksheet.LastColumnUsed方法的典型用法代码示例。如果您正苦于以下问题:C# IXLWorksheet.LastColumnUsed方法的具体用法?C# IXLWorksheet.LastColumnUsed怎么用?C# IXLWorksheet.LastColumnUsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IXLWorksheet的用法示例。


在下文中一共展示了IXLWorksheet.LastColumnUsed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddColumn

 public void AddColumn(string sheetName, string colName)
 {
     worksheet = workbook.Worksheet(sheetName);
     if(worksheet.LastColumnUsed()!=null)
         worksheet.LastColumnUsed().ColumnRight().Cell(1).Value = colName;
     else
         worksheet.Cell("A1").Value = colName;
     Save();
 }
开发者ID:sandeepsajiru,项目名称:DataDrivenFramework,代码行数:9,代码来源:ExcelHelper.cs

示例2: getTotalWidth

        public static double getTotalWidth(IXLWorksheet ws, int startCol)
        {
            var totalWidth = 0.0;
            foreach (var col in ws.Columns(startCol, ws.LastColumnUsed().ColumnNumber()))
            {
                totalWidth += col.Width * 5.69;
            }

            return totalWidth;
        }
开发者ID:vadimPoliansky,项目名称:TestPR_Dev,代码行数:10,代码来源:ExcelFunctions.cs

示例3: SplitKD

        private static bool SplitKD(IXLWorksheet worksheet, string title, int column)
        {
            // row to scan for KD
            const int row = 6;

            try
            {
                while (!worksheet.Cell(row, column).IsEmpty())
                {
                    // scan for first KD derivative in TRIM LEVEL row
                    if (worksheet.Cell(row, column).GetString().EndsWith("KD"))
                    {
                        // remove existing column grouping - commented out as grouping no longer applied as you can't un-group on a protected worksheet
                        // worksheet.Columns(8, worksheet.LastColumnUsed().ColumnNumber()).Ungroup();
                        // add KD SPEC GROUP heading
                        worksheet.Cell(1, column).Value = title.ToUpper() + " KD";
                        // insert and size new divider column before KD derivatives
                        worksheet.Column(column).InsertColumnsBefore(1);
                        worksheet.Column(column).Width = 8;
                        // group non-KD derivatives - commented out as you can't un-group on a protected worksheet
                        // worksheet.Columns(8, column - 1).Group();
                        // merge non-KD SPEC GROUP heading
                        worksheet.Range(1, 8, 1, column - 1).Merge();
                        // group KD derivatives - commented out as you can't un-group on a protected worksheet
                        // worksheet.Columns(column + 1, worksheet.LastColumnUsed().ColumnNumber()).Group();
                        // merge KD SPEC GROUP heading
                        worksheet.Range(1, column + 1, 1, worksheet.LastColumnUsed().ColumnNumber()).Merge();
                        // add vertical KD title
                        worksheet.Cell(1, column).Value = title.ToUpper() + " KD";
                        // merge and format vertical divider heading
                        worksheet.Range(1, column, 9, column).Merge();
                        worksheet.Range(1, column, worksheet.LastRowUsed().RowNumber(), column).Style
                            .Font.SetBold(true)
                            .Font.SetFontColor(XLColor.White)
                            .Fill.SetBackgroundColor(XLColor.Black)
                            .Alignment.SetVertical(XLAlignmentVerticalValues.Bottom)
                            .Alignment.SetTextRotation(90);
                        // do for first KD derivative then break out
                        return true;
                    }
                    column = column + 1;
                }
                return false;
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }

        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:51,代码来源:ExcelHelper.cs


注:本文中的IXLWorksheet.LastColumnUsed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。