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


C# IXLWorksheet.LastRowUsed方法代码示例

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


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

示例1: getTotalHeight

        public static double getTotalHeight(IXLWorksheet ws, int startRow)
        {
            var totalHeight = 0.0;
            foreach (var row in ws.Rows(startRow, ws.LastRowUsed().RowNumber()))
            {
                totalHeight += row.Height;
            }

            return totalHeight;

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

示例2: GetRowCount

 public int GetRowCount(string sheetName)
 {
     worksheet = workbook.Worksheet(sheetName);
     return worksheet.LastRowUsed().RowNumber();
 }
开发者ID:sandeepsajiru,项目名称:DataDrivenFramework,代码行数:5,代码来源:ExcelHelper.cs

示例3: GetColumnNumber

        private int GetColumnNumber(String sheetName, String colName)
        {
            worksheet = workbook.Worksheet(sheetName);
            IXLRow r =  worksheet.Row(1);
            while (r != worksheet.LastRowUsed())
            {

                foreach(IXLCell c in r.CellsUsed())
                {
                    if (c.Value.Equals(colName))
                        return c.Address.ColumnNumber; // Starts with 0
                }

                r = r.RowBelow();
            }
            return -1;
        }
开发者ID:sandeepsajiru,项目名称:DataDrivenFramework,代码行数:17,代码来源:ExcelHelper.cs

示例4: AddPerformanceFormatting

        private void AddPerformanceFormatting(IXLWorksheet performanceSheet)
        {
            int lastRowUsed = performanceSheet.LastRowUsed().RowNumber();
            //freeze panels
            performanceSheet.SheetView.Freeze(1, 2);
            //performance global styles
            performanceSheet.Range(1, 1, performanceSheet.LastCellUsed().Address.RowNumber, performanceSheet.LastCellUsed().Address.ColumnNumber)
                .Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
            //column specific formatting

            //date columns
            performanceSheet.Range(string.Format("A2:A{0}", lastRowUsed)).Style.DateFormat.Format = "dd/MM/yyyy";

            //percentage formatting (0.00%)
            performanceSheet.Ranges(string.Format("E2:E{0},H2:I{1},Y2:Y{2},AC2:AC{3},AE2:AF{4},AH2:AI{5},AK2:AL{6},AN2:AO{7}",
                lastRowUsed, lastRowUsed, lastRowUsed, lastRowUsed, lastRowUsed, lastRowUsed, lastRowUsed, lastRowUsed
            )).Style.NumberFormat.NumberFormatId = 10;

            //no decimal points
            performanceSheet.Range(string.Format("R2:R{0}", lastRowUsed)).Style.NumberFormat.Format = "0";

            //decimal format (0.00)
            performanceSheet.Ranges(string.Format("J2:J{0},L2:N{1}",
                lastRowUsed, lastRowUsed
            )).Style.NumberFormat.Format = "0.00";

            //three decimal points (0.000)
            performanceSheet.Range(string.Format("U2:U{0}",
                lastRowUsed
            )).Style.NumberFormat.Format = "0.000";

            //money with two decimals ($ 0.00)
            performanceSheet.Ranges(string.Format("T2:T{0},W2:W{1},Z2:Z{2}",
                lastRowUsed, lastRowUsed, lastRowUsed
            )).Style.NumberFormat.Format = "$ 0.00";

            //money with three decimals ($ 0.000)
            performanceSheet.Range(string.Format("V2:V{0}",
                lastRowUsed, lastRowUsed, lastRowUsed
            )).Style.NumberFormat.Format = "$ 0.000";

            // adjust to content
            performanceSheet.Columns().AdjustToContents();
        }
开发者ID:rodrigoi,项目名称:shipoopi,代码行数:44,代码来源:ExcelReporter.cs

示例5: FindRowById

 private static IXLRow FindRowById(string id, IXLWorksheet worksheet)
 {
     var lastRowUsed = worksheet.LastRowUsed().RowNumber();
     for (int rowIndex = 0; rowIndex <= lastRowUsed; rowIndex++) {
         if (worksheet.Row(rowIndex).Cell(1).GetValue<string>().ToLower() == id.ToLower()) {
             return worksheet.Row(rowIndex);
         }
     }
     return null;
 }
开发者ID:rodrigoi,项目名称:xml-conversion-tool,代码行数:10,代码来源:ExcelInterpreter.cs

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