zoukankan      html  css  js  c++  java
  • Aspose.Cells相应操作及下载

    Aspose.Cells相应操作

    1,上传

    1.1 Workbook

    Workbook workBook = new Workbook();

    属性:

    名称

    值类型

    说明

    Colors

    Color[]

    获取或设置Excel颜色

    ConvertNumericData

    bool

    获取或设置是否将字符串转换至数字数据

    默认值为 true

    DataSorter

    DataSorter

    获取或设置数据分级

    Date1904

    bool

    DefaultStyle

    Aspose.Cells.Style

    获取或设置工作簿默认样式

    HasMacro

    bool

    获取工作簿是否包含宏观调控或宏

    IsHScrollBarVisible

    bool

    获取或设置左部滚动条(控制行)

    默认值为true

    IsProtected

    bool

    获取工作簿保护状态

    IsVScrollBarVisible

    bool

    获取或设置底部滚动条(控制列)

    默认值为true

    Language

    CountryCode --枚举类型

    获取或设置语言

    默认为当前计算机区域

    Password

    string

    获取或设置工作簿密码

    ReCalcOnOpen

    bool

    获取或设置是否重新计算所有打开文件的公式

    Region

    CountryCode --枚举类型

    获取或设置工作簿区域(指当前使用者区域)

    默认为当前计算机区域

    Shared

    bool

    获取或设置当前工作簿是否共享

    默认为false

    ShowTabs

    bool

    获取或设置是否显示标签(工作表标签)

    默认为true

    Styles

    Styles

    样式集合

    Worksheets

    Worksheet

    事件:

    CalculateFormula(bool ignoreError

    ,ICustomFunction customFunction) +3

    void

    计算公式

    ChangePalette(Color color,int index)

    void

    设置当前颜色在调色版中显示顺序

    Combine(Workbook secondWorkbook)

    void

    联合工作簿,将secondWorkbook 工作簿中workSheet追加到当前工作簿中

    Copy(Workbook source)

    void

    拷贝工作簿到当前工作簿

    Decrypt(string password)

    void

    解除工作簿密码

    IsColorInPalette(Color color)

    bool

    将color加入到当前Excel调色版

    LoadData(string fileName)

    LoadData(System.IO.Stream stream)

    void

    加载Excel到当前Workbook中

    Open(string fileName,

    FileFormatType.Default,

    string password ); +8 

    void

    打开Excel文件

    Protect(ProtectionType.All,

    string password);

    void

    写保护,并设置取消工作簿保护密码

    RemoveExternalLinks()

    void

    移除外部链接

    RemoveMacro()

    void

    移除宏

    Replace (string PlaceHolder,

    string newValue);  +8

    void

    工作簿中类型和值完全符合的单元格,将其替换为新值或对象

    Save(Server.UrlEncode("测试.xls"),

    FileFormatType.Default, SaveType.OpenInExcel, Response);+8

    Void 

    保存工作簿

    SaveToStream()

    System.IO.MemoryStream

    将工作簿写入内存流中

    Unprotect(string password);

    Void

    取消工作簿保护状态

    ValidateFormula(string formula)

    bool

    验证公式

    1.2 Worksheet

    Worksheet worksheet=workbook.Worksheets[index];

    or

    Worksheet worksheet= new Worksheet();

    属性:

    名称

    值类型

    说明

    ActiveCell

    string

    获取或设置当前活动单元格

    AutoFilter

    AutoFilter

    自动筛选

    Cells

    Cells

    单元格集合

    Charts

    Charts

    CheckBoxes

    CheckBoxes

    CodeName

    string

    获取编码名称(“Sheet1”。。。)

    Comments

    Comments

    ConditionalFormattings

    ConditionalFormattings

    DisplayRightToLeft

    bool

    获取或设置当前工作表显示方向;是否从右至左

    默认为 false

    FirstVisibleColumn

    int

    获取或设置当前工作表显示的起始行

    FirstVisibleRow

    int

    获取或设置 工作表显示的起始列

    HPageBreaks

    HPageBreaks

    Hyperlinks

    Hyperlinks

    Index

    int

    获取当前工作表索引(标签位置);

    下标从0开始

    IsGridlinesVisible

    bool

    获取或设置是否显示网格

    IsPageBreakPreview

    bool

    获取或设置是否显示为分页预览

    默认为false

    IsProtected

    bool

    获取Excel保护状态

    IsRowColumnHeadersVisible

    bool

    获取或设置是否显示行和列标题;默认为true

    IsVisible

    bool

    获取或设置是否显示当前标签;

    默认为 true

    ListObjects

    ListObjects

    Name

    string

    获取或设置标签名称

    OleObjects

    OleObjects

    Outline

    Outline

    PageSetup

    PageSetup

    Pictures

    Pictures

    PivotTables

    PivotTables

    Protection

    Protection

    Shapes

    Shapes

    TabColor

    System.Drawing.Color

    获取或设置标签颜色

    TextBoxes

    TextBoxes

    Type

    SheetType—枚举值

    Validations

    Validations

    VPageBreaks

    VPageBreaks

    Workbook

    Workbook

    当前标签的Workbook

    Zoom

    int

    获取或设置显示比例;单位为百分比,有效数值10-400之间

    1.2.1 AutoFitColumn

    指定列设置为自适应列宽

    void Worksheet.AutoFitColumn(columnIndex,firstRow,lastRow); +2

    名称

    值类型

    说明

    columnIndex

    int

    列标,从0开始

    firstRow

    int

    开始行,从0开始

    lastRow

    int

    结束行,从0开始

    返回

    说明

    void

    1.2.2 AutoFitColumns

    设置所有列为自适应列宽

    void Worksheet.AutoFitColumns(); 

    名称

    值类型

    说明

    返回

    说明

    void

    1.2.3 AutoFitRow

    指定行设置为自适应行宽

    void Worksheet. AutoFitRow(rowIndex,firstColumn,lastColumn); +2

    名称

    值类型

    说明

    rowIndex

    int

    行标,从0开始

    firstColumn

    int

    开始列,从0开始

    lastColumn

    int

    结束列,从0开始

    返回

    说明

    void

    1.2.3 ClearComments

    清除所有批注

    void Worksheet.ClearComments(); 

    名称

    值类型

    说明

    返回

    说明

    void

    1.2.4 Copy

    清除所有批注

    void Worksheet.Copy(sourcesheet); 

    名称

    值类型

    说明

    sourcesheet

    Workbook

    工作表源

    返回

    说明

    void

    1.2.5 CopyConditionalFormatting

    拷贝有条件的格式

    void Worksheet.CopyConditionalFormatting(sourceRow,sourceColumn,destRow,destColumn); 

    名称

    值类型

    说明

    sourceRow

    int

    源行标

    sourceColumn

    int

    源列标

    destRow

    int

    目的地行标

    destColumn

    int

    目的地列标

    返回

    说明

    void

    1.2.6 CopyConditionalFormatting

    冻结窗格

    void Worksheet.FreezePanes(cellName,freezedRows,freezedColumns)

    or

    (Row,Column,freezedRows,freezedColumns); +2

    名称

    值类型

    说明

    cellName

    string

    单元格名称;例:B2

    freezedRows

    int

    冻结行(项标显示行数,如果行数大于freezedRows,超出行隐藏)

    freezedColumns

    int

    冻结列(左标显示列数,如果列数大于freezedColumns,超出列隐藏)

    Row

    int

    行标

    Column

    int

    列标

    返回

    说明

    void

    1.2.7 GetSelectedRanges

    获取当前光标停留的单元格

    ArrayList Worksheet.GetSelectedRanges()

    名称

    值类型

    说明

    返回

    说明

    System.Collections.ArrayList

    1.2.8 Move

    获取当前光标停留的单元格

    void Worksheet.Move(index)

    名称

    值类型

    说明

    index

    int

    移动至索引序号

    返回

    说明

    void

    1.2.9 Protect

    写保护

    void Worksheet.Protect(type,password,oldPassword); +2

    名称

    值类型

    说明

    type

    ProtectionType –枚举型

    设置保护

    password

    string

    oldPassword

    string

    返回

    说明

    void

    1.2.10 RemoveAllDrawingObjects

    删除所有图画(图表)对象

    void Worksheet.RemoveAllDrawingObjects();

    名称

    值类型

    说明

    返回

    说明

    void

    1.2.11 RemoveSplit

    删除拆分

    void Worksheet.RemoveSplit();

    名称

    值类型

    说明

    返回

    说明

    void

    1.2.12 Replace

    在工作表中替换符合要求单元格值

    void Worksheet.Replace(oldString, newString);

    名称

    值类型

    说明

    oldString

    string

    要替换字符串(完全相等)

    newString

    string

    替换字符串

    返回

    说明

    void

    1.2.13 SetBackground

    设置背景图片

    void Worksheet.SetBackground(pictureData);

    名称

    值类型

    说明

    pictureData

    byte[]

    图片字节

    返回

    说明

    void

    1.2.14 Split

    拆分工作表

    void Worksheet.Split();

    名称

    值类型

    说明

    返回

    说明

    void

    1.2.15 UnFreezePanes

    联合冻结窗格

    void Worksheet.UnFreezePanes();

    名称

    值类型

    说明

    返回

    说明

    void

    1.2.16 Unprotect

    解除保护

    void Worksheet.Unprotect(password);

    名称

    值类型

    说明

    password

    string

    工作表密码

    返回

    说明

    void

    1.3 Worksheets

    Worksheets worksheets= workbook.Worksheets;

    or

    Worksheets worksheets= new Worksheets();

    属性:

    名称

    值类型

    说明

    ActiveSheetIndex

    int

    获取或设置当前活动工作表

    BuiltInDocumentProperties

    BuiltInDocumentProperties

    设置内置文件属性

    Capacity

    int

    获取或设置工作表包含元素数

    Count

    int

    获取工作表数量

    CustomDocumentProperties

    CustomDocumentProperties

    承接定做活的文件属性

    EnableHTTPCompression

    bool

    获取或设置使用HTTP压缩

    ExternalLinks

    ExternalLinks

    获取或设置外部链接

    Names

    Names

    SheetTabBarWidth

    int

    获取或设置工作表标签列表显示宽度;有效宽度1/1000

    WindowHeightCM

    double

    WindowHeightInch

    double

    WindowLeftCM

    double

    WindowLeftInch

    double

    WindowTopCM

    double

    WindowTopInch

    double

    WindowWidthCM

    double

    WindowWidthInch

    double

    1.3.1 Add +3

    新增工作表

    Worksheet Worksheets.Add();

    or

    Worksheet Worksheets.Add(type)

    or

    Worksheet Worksheets.Add(sheetName)

    名称

    值类型

    说明

    type

    SheetType –枚举型

    新增工作表的类型

    sheetName

    string

    新增工作表标签名

    返回

    说明

    Worksheet

    1.3.2 AddCopy +2

    拷贝现有工作表至新增工作表

    int Worksheets.AddCopy(sheetIndex);

    or

    int Worksheets.AddCopy(sheetName);

    名称

    值类型

    说明

    sheetIndex

    int 

    工作表的索引

    sheetName

    string

    工作表标签名

    返回

    说明

    int

    1.3.3 Clear

    删除当前工作表

    void Worksheets.Clear(); 

    名称

    值类型

    说明

    返回

    说明

    void

    1.3.4 DeleteName

    删除指定的 range

    void Worksheets.DeleteName(definedName); 

    名称

    值类型

    说明

    definedName

    string

    range的名称

    返回

    说明

    void

    1.3.5 GetEnumerator

    获取所有统计员

    IEnumerator Worksheets.GetEnumerator(); 

    名称

    值类型

    说明

    返回

    说明

    IEnumerator

    统计员接口

    1.3.6 GetNamedRanges

    获取所有range实体

      Range[] Worksheets.GetNamedRanges(); 

    名称

    值类型

    说明

    返回

    说明

      Range[]

    range实体

    1.3.7 GetRangeByName

    根据 range来获取

      Range Worksheets. GetRangeByName(rangeName); 

    名称

    值类型

    说明

    rangeName

    string

    range名称

    返回

    说明

      Range

    1.3.8 RemoveAt

    删除工作表

      void Worksheets.RemoveAt(indexer);

    Or

    void Worksheets.RemoveAt(name); 

    名称

    值类型

    说明

    indexer

    int

    工作表索引

    name

    string

    工作表名称

    返回

    说明

      void

    1.3.9 SetOleSize

    Sets displayed size when Workbook file is used as an Ole object.

     void Worksheets.SetOleSize(startRow,endRow,startColumn,endColumn); 

    名称

    值类型

    说明

    startRow

    int

    起始行

    endRow

    int

    结束行

    startColumn

    int

    起始列

    endColumn

    int

    结束列

    返回

    说明

      void

    1.3.10 SortNames

    按名称排序range

     void Worksheets.SortNames(); 

    名称

    值类型

    说明

    返回

    说明

      void

    1.4 Cells

    Cells cells = new Cells();

    or

    Worksheets.Cells

    属性:

    名称

    值类型

    说明

    Capacity

    int

    获取或设置包含元素数

    Columns

    Columns

    列集合

    Count

    int

    获取有效单元格数量(非空单元格)

    End

    Cell

    获取最后单元格

    IsStringsPreserved

    bool

    获取或设置是否用字符来代替密码

    MaxColumn

    int

    获取当前工作表最大列,列下标从0开始

    MaxDataColumn

    int

    获取最大包含数据列;列下标从0开始

    MaxDataRow

    int

    获取最大包含数据行; 行下标从0开始

    MaxRow

    int

    获取最大行,行下标从0开始

    MergedCells

    System.Collections.ArrayList

    合并单元格

    MinColumn

    int

    获取最小列, 列下标从0开始

    MinRow

    int

    获取最小行,行下标从0开始

    Ranges

    Ranges

    获取或设置range实体类

    Rows

    Rows

    行集合

    StandardHeight

    double

    获取或设置单元格高度

    StandardWidth

    double

    获取或设置单元格宽度

    Start

    Cell

    起始单元格

    1.4.1 ApplyColumnStyle

    设置工作表列样式

    void Cells.ApplyColumnStyle(Column,style,styleFlag);

    名称

    值类型

    说明

    Column

    int

    列号,下标从0开始

    style

    Style

    styleFlag

    StyleFlag

    返回

    说明

      void

    1.4.2 ApplyRowStyle

    设置工作表行样式

     void Cells.ApplyRowStyle(row,style,styleFlag); 

    名称

    值类型

    说明

    row

    int

    行号,下标从0开始

    style

    Style

    styleFlag

    StyleFlag

    返回

    说明

      void

    1.4.3 ApplyStyle

    设置工作表所有单元格样式

     void Cells.ApplyStyle(style,styleFlag); 

    名称

    值类型

    说明

    style

    Style

    styleFlag

    StyleFlag

    返回

    说明

      void

    1.4.4 CheckExistence

    检查单元格,如果为空返回-1,否刚返回从0行0列单元格开始至当前检索单元格非空值数量

    int Cells.CheckExistence(row,column);

    名称

    值类型

    说明

    row

    int

    column

    int

    返回

    说明

      int

    如果为空返回-1,否刚返回从0行0列单元格开始至当前检索单元格非空值数量

    1.4.5 Clear

    删除所有单元格数据

    void Cells.Clear();

    名称

    值类型

    说明

    返回

    说明

      void

    1.4.6 ClearContents

    删除起始单元格至结束单元格数据

    void Cells.ClearContents(startRow,startColumn,endRow,endColumn);

    名称

    值类型

    说明

    startRow

    int

    起始行

    startColumn

    int

    起始列

    endRow

    int

    结束行

    endColumn

    int

    结束列

    返回

    说明

      void

    1.4.7 ClearFormats

    删除起始单元格至结束单元格格式

    void Cells.ClearFormats(startRow,startColumn,endRow,endColumn);

    名称

    值类型

    说明

    startRow

    int

    起始行

    startColumn

    int

    起始列

    endRow

    int

    结束行

    endColumn

    int

    结束列

    返回

    说明

      void

    1.4.8 ClearRange

    删除起始单元格至结束单元格格式和数据

    void Cells.ClearRange(startRow,startColumn,endRow,endColumn);

    名称

    值类型

    说明

    startRow

    int

    起始行

    startColumn

    int

    起始列

    endRow

    int

    结束行

    endColumn

    int

    结束列

    返回

    说明

      void

    1.4.9 ConvertStringToNumericValue

    将所有字符串型数据转换为数值型数据

    void Cells.ConvertStringToNumericValue();

    名称

    值类型

    说明

    返回

    说明

      void

    1.4.10 CopyColumn

    拷贝列

    void Cells.CopyColumn(sourceCells,sourceColumnIndex,destinationColumnIndex);

    名称

    值类型

    说明

    sourceCells

    Cells

    源单元格集合

    sourceColumnIndex

    int

    源列索引

    destinationColumnIndex

    int

    目的地列索引

    返回

    说明

      void

    1.4.11 CopyRow

    拷贝行

    void Cells.CopyRow(sourceCells, sourceRowIndex, destinationRowIndex);

    名称

    值类型

    说明

    sourceCells

    Cells

    源单元格集合

    sourceRowIndex

    int

    源行索引

    destinationRowIndex

    int

    目的地行索引

    返回

    说明

      void

    1.4.12 CreateRange

    创建 range

    Range Cells.CreateRange(upperLeftCell,lowerRightCell);

    or

    Range Cells.CreateRange(firstIndex,unmber,isVertical);

    or

    Range Cells.CreateRange(firstRow,firstColumn,rowNumber,columnNumber);

    名称

    值类型

    说明

    upperLeftCell

    string

    左单元格名称

    lowerRightCell 

    string

    右单元格名称

    firstIndex

    int

    指定range首列或首行索引(行或列由isVertical确定)

    unmber

    int

    指定range首列或首行索引的偏移量(行或列由isVertical确定)

    isVertical

    bool

    是否垂直延伸;True为行,如果为行刚包含所有列;false为列; 如果为列刚包含所有行

    firstRow

    int

    指定range首行索引

    firstColumn

    int

    指定range首列索引

    rowNumber

    int

    指定行索引偏移量

    columnNumber

    int

    指定列索引偏移量

    返回

    说明

      Range

    1.4.13 DeleteColumn +2

    删除列

    void Cells.DeleteColumn(columnIndex);

    and 

    void Cells.DeleteColumn(columnIndex, updateReference);

    名称

    值类型

    说明

    columnIndex

    int

    将要删除列索引

    updateReference

    bool

    更新参考

    返回

    说明

      void

    1.4.14 DeleteRange

    移除指定range内的单元格,并设置range外列的方向

    void Cells.DeleteRange(stratRow,startColumn,endRow,endColumn,shiftType);

    名称

    值类型

    说明

    stratRow

    int

    起始行

    startColumn

    int

    起始列

    endRow

    int

    结束行

    endColumn

    int

    结束列

    shiftType

    ShiftType –枚举

    range外列填充方向

    返回

    说明

      void

    1.4.15 DeleteRow

    删除指定行

    void Cells.DeleteRow(rowIndex);

    名称

    值类型

    说明

    rowIndex

    int

    将要删除行索引

    返回

    说明

      void

    1.4.16 DeleteRows +2

    删除指定行集合

    void Cells.DeleteRows(rowIndex,rowNumber);

    and 

    void Cells.DeleteRows(rowIndex,rowNumber,updateReference);;

    名称

    值类型

    说明

    rowIndex

    int

    将要删除列索引

    rowNumber

    int

    指定删除的行数目

    updateReference

    bool

    更新参考

    返回

    说明

      void

    1.4.17 EndCellInColumn +2

    void Cells.EndCellInColumn(columnIndex);

    and 

    void Cells. EndCellInColumn(startRow,endRow,startColumn,endColumn);

    名称

    值类型

    说明

    columnIndex

    byte

    startRow

    int

    endRow

    int

    startColumn

    byte

    endColumn

    byte

    返回

    说明

      void

    1.4.18 EndCellInRow +2

    void Cells.EndCellInRow(rowIndex);

    and 

    void Cells.EndCellInRow(startRow,endRow,startColumn,endColumn);

    名称

    值类型

    说明

    rowIndex

    int

    startRow

    int

    endRow

    int

    startColumn

    byte

    endColumn

    byte

    返回

    说明

      void

    1.4.19 ExportArray 

    输出指定range单元格内容到 object二维数组中

    object[,] Cells.ExportArray(firstRow,firstColumn,rowNumber,columnNumber);

    名称

    值类型

    说明

    firstRow

    int

    首行

    firstColumn

    int

    首列

    rowNumber

    int

    行数目

    columnNumber

    int

    列数目

    返回

    说明

      object[,]

    1.4.20 ExportDataTable +4

    输出指定range单元格内容到 DataTable中;每列单元格以统一格式导入到Excel,如果列所有单元格有不同格式的值,输出会报错 

    DataTable Cells.ExportDataTable(firstRow,firstColumn,rowNumber,columnNuber);

    Or

    DataTable Cells.ExportDataTable(firstRow,firstColumn,rowNumber,columnNuber,exportColumnName);

    Or 

    DataTable Cells.ExportDataTable(firstRow,firstColumn,rowNumber,columnNumber,defaultValues);

    Or

    DataTable ExportDataTable(firstRow,firstColumn,rowNumber,columnNumber,exportColumnName,isVertical);

    名称

    值类型

    说明

    firstRow

    int

    首行

    firstColumn

    int

    首列

    rowNumber

    int

    行数目

    columnNumber

    int

    列数目

    exportColumnName

    bool

    是否输出行名

    isVertical

    bool

    如果isVertical为true,列转DataTable列

    如果isVertical为false,列转DataTable行

    defaultValues

    object[]

    输出默认值

    返回

    说明

      DataTable

    1.4.21 ExportDataTableAsString +2

    输出指定range单元格数据以字符串格式输出到 DataTable中

    DataTable Cells. ExportDataTableAsString(firstRow,firstColumn,rowNumber,columnNumber);

    Or

    DataTable Cells.ExportDataTableAsString(firstRow,firstColumn,rowNumber,columnNumber, exportCloumnName)

    名称

    值类型

    说明

    firstRow

    int

    首行

    firstColumn

    int

    首列

    rowNumber

    int

    行数目

    columnNumber

    int

    列数目

    exportColumnName

    bool

    是否输出行名

    返回

    说明

      DataTable

    1.4.22 ExportTypeArray 

    输出指定range单元格数据类型 至CellValueType二维数组中

    CellValueType[,] Cells.ExportTypeArray(firstRow,firstColumn,rowNumber,columnNumber);

    名称

    值类型

    说明

    firstRow

    int

    首行

    firstColumn

    int

    首列

    rowNumber

    int

    行数目

    columnNumber

    int

    列数目

    返回

    说明

      CellValueType[,]

    返回每个单元格数据类型

    1.4.23 FindFormula 

    返回当前工作表中公式和formula相同的第一个单元格

    Cell Cells.FindFormula(formula,previousCell);

    名称

    值类型

    说明

    formula

    string

    Excel公式

    previousCell

    Cell

    返回

    说明

      Cell

    1.4.24 FindFormulaContains

    返回当前工作表中公式包含formula字符串的第一个单元格

    Cell Cells.FindFormulaContains(formula,previousCell);

    名称

    值类型

    说明

    formula

    string

    公式字符串;例:”=”,”SUM”等

    previousCell

    Cell

    返回

    说明

      Cell

    1.4.25 FindNumber +2

    返回当前工作表中单元格格式为数值型并值为inputString的第一个单元格

    Cell Cells.FindNumber(inputNumber,previousCell);

    Or

    Cell Cells.FindNumber(inputNumber,previousCell);

    名称

    值类型

    说明

    inputNumber

    Double

     Or

     int

    公式字符串;例:”=”,”SUM”等

    previousCell

    Cell

    返回

    说明

      Cell

    1.4.26 FindString +3

    返回当前工作表中单元格格式为字符串型并值为inputString的第一个单元格

    Cell Cells.FindString(inputString,previousCell);

    Or

    Cell Cells.FindString(inputString,previousCell,upDown);

    Or

    Cell Cells.FindString(inputString,previousCell,area);

    名称

    值类型

    说明

    inputString

    string

    查询单元格值

    previousCell

    Cell

    upDown

    bool

    area

    CellArea

    返回

    说明

      Cell

    1.4.27 FindStringContains +3

    返回当前工作表中单元格格式为字符型并值包含inputString的第一个单元格

    Cell Cells. FindStringContains (inputString,previousCell);

    Or

    Cell Cells. FindStringContains (inputString,previousCell,isCaseSensitive);

    Or

    Cell Cells. FindStringContains(inputString,previousCell,isCaseSensitive,area);

    名称

    值类型

    说明

    inputString

    string

    查询单元格包含的值

    previousCell

    Cell

    isCaseSensitive

    bool

    area

    CellArea

    返回

    说明

      Cell

    1.4.28 FindStringEndsWith 

    返回当前工作表中单元格格式为字符串并值尾部位置为 inputString的第一个单元格

    Cell Cells. FindStringEndsWith (inputString,previousCell);

    名称

    值类型

    说明

    inputString

    string

    查询单元格包含的值

    previousCell

    Cell

    返回

    说明

      Cell

    1.4.29 FindStringStartsWith

    返回当前工作表中单元格格式为字符串并值头部位置为 inputString的第一个单元格

    Cell Cells. FindStringStartsWith(inputString,previousCell);

    名称

    值类型

    说明

    inputString

    string

    查询单元格包含的值

    previousCell

    Cell

    返回

    说明

      Cell

    1.4.30 GetColumnWidth

    获取指定列的列宽

    double Cells.GetColumnWidth(column);

    名称

    值类型

    说明

    column

    int

    列索引

    返回

    说明

      double

    1.4.31 GetColumnWidthPixel

    获取指定列的列宽以像素为单位

    int Cells.GetColumnWidthPixel(column);

    名称

    值类型

    说明

    column

    int

    列索引

    返回

    说明

      int

    1.4.32 GetEnumerator

    获取统计员实体

    IEnumerator Cells.GetEnumerator();

    名称

    值类型

    说明

    column

    int

    列索引

    返回

    说明

      IEnumerator

    1.4.33 GetRowHeight

    获取行高度

    double Cells.GetRowHeight(row);

    名称

    值类型

    说明

    row

    int

    行索引

    返回

    说明

      double

    1.4.34 GetRowHeightPixel

    获取行高度以像素为单位

    int Cells.GetRowHeightPixel(row);

    名称

    值类型

    说明

    row

    int

    行索引

    返回

    说明

      int

    1.4.35 GroupColumns +2

    列分组(不带求合)

    void Cells.GroupColumns(firstIndex,lastIndex);

    or 

    void Cells.GroupColumns(firstIndex,lastIndex,isHidden)

    名称

    值类型

    说明

    firstIndex

    int

    列索引

    lastIndex

    int

    统计列索引偏移量;

    isHidden

    bool

    是否隐藏

    返回

    说明

      int

    1.4.36 GroupRows +2

    行分组(不带求合)

    void Cells.GroupRows(firstIndex,lastIndex);

    or 

    void Cells.GroupRows(firstIndex,lastIndex,isHidden)

    名称

    值类型

    说明

    firstIndex

    int

    行索引

    lastIndex

    int

    统计行索引偏移量;;

    isHidden

    bool

    是否隐藏

    返回

    说明

      int

    1.4.37 HideColumn

    隐藏列

    void Cells.HideColumn(column);

    名称

    值类型

    说明

    column

    int

    列索引

    返回

    说明

      void

    1.4.38 HideRow

    隐藏行

    void Cells.HideRow(row);

    名称

    值类型

    说明

    row

    int

    行索引

    返回

    说明

      void

    1.4.39 ImportArray +6

    将数组导入至工作表中

    void Cells.ImportArray(doubleArray,firstRow,firstColumn);

    or

    void Cells.ImportArray(intArray,firstRow,firstColumn);

    Or

    void Cells.ImportArray(stringArray,firstRow,firstColumn);

    Or

    void Cells.ImportArray(doubleArray,firstRow,firstColumn,isVertical);

    Or

    void Cells.ImportArray(intArray,firstRow,firstColumn,isVertical);

    Or

    void Cells.ImportArray(stringArray,firstRow,firstColumn,isVertical);

    名称

    值类型

    说明

    doubleArray

    double[,]

    or

    double[]

    导入数据源

    intArray

    int[,]

    or

    int[]

    导入数据源

    stringArray

    string[,]

    or

    string[]

    导入数据源

    firstRow

    Int

    起始行

    firstColumn

    int

    起始列

    isVertical

    bool

    导入工作表方向,true为坚向,false为横向

    返回

    说明

      void

    1.4.40 ImportArrayList

    将arrayList导入至工作表中

    void Cells.ImportArrayList(arrayList,firstRow,firstColumn,isVertical););

    名称

    值类型

    说明

    arrayList

    System.Collections.ArrayList

    数据源

    firstRow

    int

    起始行

    firstColumn

    byte

    起始列

    isVertical

    bool

    导入工作表方向,true为坚向,false为横向

    返回

    说明

      void

    1.4.41 ImportDataColumn +4

    指定dataTable/ dataView某列名称或列名称索引 导入到指定位置

    void  Cells.ImportDataColumn(dataTable,isFieldNameShown,firstRow,firstColumn,importColumnIndex,

    insertRows);

    or

    void  Cells.ImportDataColumn(dataTable,isFieldNameShown,firstRow,firstColumn,importColumnName,

    insertRows);

    or

    void Cells.ImportDataColumn(dataTable,ifFieldNameShown,firstRow,firstColumn,importColumnIndex,

    insertRows,defaultValue);

    or

    void Cells.ImportDataColumn(dataView,isFieldNameShown,firstRow,firstColumn,importColumnIndex

    ,insertRows);

    名称

    值类型

    说明

    dataTable

    DataTable

    数据源

    dataView

    DataView

    数据源

    isFieldNameShown

    bool

    是否写入表头

    firstRow

    int

    起始行

    firstColumn

    int

    起始列

    importColumnIndex

    Int

    DataTable列索引编号下标从0开始

    importColumnName

    string

    DataTable列名称

    insertRows

    bool

    是否为插入行

    defaultValue

    object

    默认值

    返回

    说明

      void

    1.4.42 ImportDataGrid +2

    将DataGrid导入至工作表中

    int Cells.ImportDataGrid(dataGrid,firstRow,firstColumn,insertRows);

    or

    int Cells.ImportDataGrid(dataGrid,firstRow,firstColumn,rowNumber,columnNumber,insertRows);

    名称

    值类型

    说明

    dataGrid

    DataGrid

    数据源

    firstRow

    int

    起始行

    firstColumn

    byte

    起始列

    rowNumber

    int

    指定导入行数; 最大行数等于dataGrid行数

    columnNumber

    int

    指定导入列数; 最大列数等于dataGrid列数

    insertRows

    bool

    是否为插入行

    返回

    说明

      int

    返回插入行

    1.4.43 ImportDataGridAsString

    将DataGrid值以字符串形式导入至工作表中

    int Cells.ImportDataGridAsString(dataGrid,firstRow,firstColumn,insertRows);

    名称

    值类型

    说明

    dataGrid

    DataGrid

    数据源

    firstRow

    int

    起始行

    firstColumn

    byte

    起始列

    rowNumber

    int

    指定导入行数; 最大行数等于dataGrid行数

    columnNumber

    int

    指定导入列数; 最大列数等于dataGrid列数

    insertRows

    bool

    是否为插入行

    返回

    说明

      int

    返回插入行

    1.4.44 ImportDataRow

    将DataRow导入至指定位置

    void Cells.ImportDataRow(dataRow,row,firstColumn);

    名称

    值类型

    说明

    dataRow

    DataRow

    数据源

    row

    int

    起始行

    firstColumn

    byte

    起始列

    返回

    说明

      void

    1.4.45 ImportDataTable +8

    将DataTable从指定位置导入

    int Cells.ImportDataTable(dataTable, isFieldNameShown,startCell);

    or

    int Cells.ImportDataTable(dataTable,isFieldNameShown,firstRow,firstColumn);

    or

    int Cells.ImportDataTable(dataTable,isFieldNameShown,firstRow,firstColumn,insertRows);

    or

    int Cells.ImportDataTable(dataTable,isFieldNameShown,firstRow,firstColumn,insertRows,

    convertStringToNumber);

    or

    int Cells.ImportDataTable(dataTable,isFieldNameShown,firstRow,firstColumn,rowNumber,columnNumber);

    or

    int Cells.ImportDataTable(dataTable,isFileldNameShown,firstRow,firstColumn,rowNumber,columnNumber,

    insertRows);

    or

    int Cells.ImportDataTable(dataTable,isFileldNameShown,firstRow,firstColumn,rowNumber,columnNumber,

    insertRows, dateFormatString);

    or

    int Cells.ImportDataTable(dataTable,isFileldNameShown,firstRow,firstColumn,rowNumber,columnNumber,

    insertRows, dateFormatString,convertStringToNumber);

    名称

    值类型

    说明

    dataTable

    DataTable

    数据源

    isFieldNameShown

    bool

    是否写入表头

    startCell

    string

    起始单元格名称;例:A3

    firstRow

    int

    起始行

    firstColumn

    int

    起始列

    insertRows

    bool

    是否为插入行

    convertStringToNumber

    bool

    是否将dataTable中字符型数值转换为数值型数值

    rowNumber

    int

    导入行数目

    columnNumber

    int

    导入列数目

    dateFormatString

    string

    dataTable中日期类型在工作表中显示日期格式

    返回

    说明

      int

    返回导入行数

    1.4.46 ImportDataView +7

    将DataView导入至指定位置

    int Cells.ImportDataView(dataView,firstRow,firstColumn);

    or

    int Cells.ImportDataView(dataView,firstRow,firstColumn,insertRows);

    Or

    int Cells.ImportDataView(dataView,isFieldNameShown,firstRow,firstColumn,insertRows);

    Or

    int Cells.ImportDataView(dataView,firstRow,firstColumn,rowNumber,columnNumber);

    Or

    int Cells.ImportDataView(dataView,firstRow,firstColumn,rowNumber,columnNumber,insertRows);

    Or

    int Cells.ImportDataView(dataView,isFieldNameShown,firstRow,firstColumn,rowNumber,

    columnNumber, insertRows);

    Or

    int Cells.ImportDataView(dataView,isFieldNameShown,firstRow,firstColumn,rowNumber,columnNumber, insertRows,numberFormatString);

    名称

    值类型

    说明

    dataView

    DataView

    数据源

    firstRow

    int

    起始行

    firstColumn

    byte

    起始列

    insertRows

    bool

    是否为插入行

    isFieldNameShown

    bool

    是否写表头

    rowNumber

    int

    导入行数目

    columnNumber

    int

    导入列数目

    numberFormatString

    string

    自定义格式

    返回

    说明

      int

    返回插入成功行数

    1.4.47 ImportFormulaArray

    将string[]导入至指定位置

    void Cells.ImportFormulaArray(stringArray,firstRow,firstColumn,isVertical);

    名称

    值类型

    说明

    stringArray

    string[]

    Excel公式

    firstRow

    int

    起始行

    firstColumn

    int

    起始列

    isVertical

    bool

    如果isVertical为true,以列写入

    如果isVertical为false,以行写入

    返回

    说明

      void

    1.4.48 ImportFromDataReader +3

    将DataReader导入至指定位置

    int Cells.ImportFromDataReader(oleReader,firstRow,firstColumn, insertRows);

    or

    int Cells.ImportFromDataReader(oleReader,isFieldNameShown,firstRow,firstColumn,insertRows);

    or

    int Cells.ImportFromDataReader(sqlReader,firstRow,firstColumn,insertRows);

    or

    int Cells.ImportFromDataReader(sqlReader,isFieldNameShown,firstRow,firstColumn,insertRows);

    名称

    值类型

    说明

    oleReader

    System.Data.OleDb.OleDbDataReader

    OleDbDataReader

    firstRow

    int

    起始行

    firstColumn

    int

    起始列

    insertRows

    bool

    是否插入行

    isFieldNameShown

    bool

    是否写表头

    sqlReader

    System.Data.SqlClient.SqlDataReader

    SqlDataReader

    返回

    说明

      int

    返回插入成功行数

    1.4.49 ImportGridView

    将GridView导入至指定位置 只能导入GridView当前页面

    int Cells.ImportGridView(gridView,firstRow,firstColumn,insertRows,conertStringTonumber,convertStyle);

    名称

    值类型

    说明

    gridView

    GridView

    数据源

    firstRow

    int

    起始行

    firstColumn

    int

    起始列

    insertRows

    bool

    是否插入行

    conertStringTonumber

    bool

    convertStyle

    bool

    返回

    说明

      int

    返回插入成功行数

    1.4.50 ImportObjectArray

    将object[]导入至指定位置 

    void Cells.ImportObjectArray(objArray, firstRow, firstColumn, isVertical)

    名称

    值类型

    说明

    objArray

    object[]

    数据源

    firstRow

    int

    起始行

    firstColumn

    int

    起始列

    isVertical

    bool

    如果isVertical为true,以列写入

    如果isVertical为false,以行写入

    返回

    说明

      void

    1.4.51 ImportTwoDimensionArray

    将object[,]导入至指定位置 

    void Cells.ImportTwoDimensionArray(objArray, firstRow, firstColumn);

    名称

    值类型

    说明

    objArray

    object[,]

    数据源

    firstRow

    int

    起始行

    firstColumn

    int

    起始列

    返回

    说明

      void

    1.4.53 InsertColumn +2

    向工作表插入一列空列 

    void Cells.InsertColumn(columnIndex);

    or 

    void Cells.InsertColumn(columnIndex,updateReference);

    名称

    值类型

    说明

    columnIndex

    int

    将要插入的列索引

    updateReference

    bool

    更新参考

    返回

    说明

      void

    1.4.54 InsertRange +3

    向工作表插入range 

    void Cells. InsertRange(area, shiftType); 

    or 

    void Cells. InsertRange(area, shiftNumber, shiftType); 

    or

    void Cells. InsertRange(area,shiftNumber,shiftType,updateReference);

    名称

    值类型

    说明

    area

    CellArea

    shiftType

    ShiftType –枚举

    shiftNumber

    int 

    替换数量

    updateReference

    bool

    更新参考

    返回

    说明

      void

    1.4.55 InsertRow

    向工作表插入一行空行

    void Cells.InsertRow(rowIndex); 

    名称

    值类型

    说明

    rowIndex

    int

    将要插入的行索引

    返回

    说明

      void

    1.4.56 InsertRows +2

    向工作表插入指定行数(空行)

    void Cells.InsertRows(rowIndex,rowNumber);

    or

    void Cells.InsertRows(rowIndex,rowNumber,updateReference); 

    名称

    值类型

    说明

    rowIndex

    int

    将要插入的行索引

    rowNumber

    int

    插入指定行数

    updateReference

    bool

    更新参考

    返回

    说明

      void

    1.4.57 MaxDataRowInColumn

    获取指定列最大行

    int Cells.MaxDataRowInColumn(column); 

    名称

    值类型

    说明

    column

    int

    列索引

    返回

    说明

      int

    返回行数,下标以0开始

    1.4.58 Merge

    合并单元格

    void Cells.Merge(firstRow,firstColumn,rowNumber,columnNumber); 

    名称

    值类型

    说明

    firstRow

    int

    起始行

    firstColumn

    int

    起始列

    rowNumber

    int

    行偏移量

    columnNumber

    int

    列偏移量

    返回

    说明

      void

    1.4.59 SetColumnWidth

    设置指定列的列宽

    void Cells.SetColumnWidth(columna,width); 

    名称

    值类型

    说明

    columna

    int

    列索引

    width

    double

    设置列宽

    返回

    说明

      void

    1.4.60 SetColumnWidthPixel

    设置指定列的列宽(以像素为单位)

    void Cells.SetColumnWidthPixel(Column,pixel);

    名称

    值类型

    说明

    columna

    int

    列索引

    pixel

    int

    设置列宽以像素为单位

    返回

    说明

      void

    1.4.61 SetRowHeight

    设置指定行的行高

    void Cells.SetRowHeight(row,height);

    名称

    值类型

    说明

    row

    int

    行索引

    height

    double

    设置行高

    返回

    说明

      void

    1.4.62 SetRowHeightPixel

    设置指定行的行高(以像素为单位)

    void Cells. SetRowHeightPixel(row,pixels);

    名称

    值类型

    说明

    row

    int

    行索引

    pixels

    int

    设置行高以像素为单位

    返回

    说明

      void

    1.4.63 UngroupColumns

    取消分组(列)

    void Cells.UngroupColumns(firstIndex,lastIndex);

    名称

    值类型

    说明

    firstIndex

    int

    起始列索引

    lastIndex

    int

    最后的列索引

    返回

    说明

      void

    1.4.64 UngroupRows

    取消分组(行)

    void Cells.UngroupRows(firstIndex,lastIndex);

    名称

    值类型

    说明

    firstIndex

    int

    起始行索引

    lastIndex

    int

    最后的行索引

    返回

    说明

      void

    1.4.65 UnhideColumn

    取消隐藏 并设置列宽(列)

    void Cells.UnhideColumn(column,width);

    名称

    值类型

    说明

    column

    int

    列索引

    width

    double

    设置列宽

    返回

    说明

      void

    1.4.66 UnhideRow

    取消隐藏 并设置行高(行)

    void Cells.UnhideRow(row,height);

    名称

    值类型

    说明

    row

    int

    行索引

    height

    double

    设置行高

    返回

    说明

      void

    1.4.67 UnhideRow

    取消合并单元格

    void Cells.UnMerge(firstRow,firstColumn,rowNumber,columnNumber);

    名称

    值类型

    说明

    firstRow

    int

    起始列索引

    firstColumn

    int

    起始行索引

    rowNumber

    int

    行偏移量

    columnNumber

    int

    列偏移量

    返回

    说明

      void

    1.5 Cell

    Cell cells = new Cell();

    or

    Worksheets.Cells[int index]

    or

    Worksheets.Cells[string cellName]

    Or

    Worksheets.Cells[int row, int column]

    属性:

    名称

    值类型

    说明

    BoolValue

    bool

    获取布尔值

    Column

    int

    获取列索引

    DateTimeValue

    DateTime

    获取时间值

    DoubleValue

    double

    获取double值

    FloatValue

    float

    获取float值

    Formula

    string

    获取或设置单元格公式

    HtmlString

    string

    获取HTML字符串

    IntValue

    int

    获取int值

    IsErrorValue

    bool

    获取错误值

    IsFormula

    bool

    获取是否存在公式

    IsMerged

    bool

    获取是否合并单元格

    IsStyleSet

    bool

    获取单元格是否设置样式

    Name

    string

    获取单元格名称

    R1C1Formula

    string

    获取或设置

    Row

    int

    获取行索引

    StringValue

    string

    获取string值

    Style

    Aspose.Cells.Style

    获取或设置单元格样式

    Type

    CellValueType –枚举

    获取值类型

    Value

    object

    获取单元格值

    1.5.1 Characters

    获取指定长度字符

    Characters Cell.Characters(startIndex,length);

    名称

    值类型

    说明

    startIndex

    int

    起始字符位索引

    length

    int

    获取字符偏移量(个数)

    返回

    说明

      Characters

    1.5.2 GetMergedRange

    获取合并单元格range

    Range Cell.GetMergedRange();

    名称

    值类型

    说明

    返回

    说明

      Range

    1.5.3 PutValue +7

    设置单元格值

    void Cell.PutValue(boolValue);

    or

    void Cell.PutValue(dateTime);

    Or

    void Cell.PutValue(doubleValue);

    Or

    void Cell.PutValue(intValue);

    Or

    void Cell.PutValue(objectValue);

    Or

    void Cell.PutValue(stringValue);

    Or

    void Cell.PutValue(stringValue,isConverted);

    名称

    值类型

    说明

    boolValue

    bool

    dateTime

    DateTime

    doubleValue

    double

    intValue

    int

    objectValue

    object

    stringValue

    string

    isConverted

    bool

    是否转换(为false 在单元格以文本显示)

    返回

    说明

      void

    1.5.4 SetAddInFormula

    设置增加格式

    void Cell.SetAddInFormula(addInFileName,addInEunction);

    名称

    值类型

    说明

    addInFileName

    string

    文件名称

    addInEunction

    string

    格式

    返回

    说明

      void

    1.5.5 SetArrayFormula

    设置增加格式

    void Cell.SetArrayFormula(arrayFormula,rowNumber,columnNumber);

    名称

    值类型

    说明

    arrayFormula

    string

    字符数组格式

    rowNumber

    int

    行数

    columnNumber

    int

    列数

    返回

    说明

      void

    1.5.6 SetSharedFormula

    设置增加共享格式

    void Cell.SetSharedFormula(sharedFormula,rowNumber,columnNumber);

    名称

    值类型

    说明

    sharedFormula

    string

    共享格式

    rowNumber

    int

    行数

    columnNumber

    int

    列数

    返回

    说明

      void

    1.5.7 SetSharedFormula

    设置样式

    void Cell.SetStyle(style)

    名称

    值类型

    说明

    style

    Aspose.Cells.Style

    样式

    返回

    说明

      void

    1.6 Ranges

    Ranges ranges= new Ranges ();

    or

    Ranges ranges=Worksheets.Cells. Ranges; 

    属性:

    名称

    值类型

    说明

    Capacity

    int

    获取或设置包含元素数

    Count

    int

    获取Range 个数

    1.6.1 Clear

    清空range

    void Ranges.Clear();

    名称

    值类型

    说明

    style

    Aspose.Cells.Style

    样式

    返回

    说明

      void

    1.7 Range

    Range range= new Range();

    or

    Range range=Worksheets.Cells. Ranges[int indext]; 

    属性:

    名称

    值类型

    说明

    ColumnCount

    int

    获取range列数

    ColumnWidth

    double

    获取或设置range列宽

    FirstColumn

    int

    获取range起始列

    FirstRow

    int

    获取range起始行

    Name

    string

    获取或设置range的名称

    RowCount

    int

    获取 range 行数

    RowHeight

    double

    获取 range 行高

    Style

    Aspose.Cells.Style

    获取或设置 range 的样式

    Worksheet

    Worksheet

    1.7.1 ApplyStyle

    设置range 样式

    void Range.ApplyStyle(style, styleFlag);

    名称

    值类型

    说明

    style

    Aspose.Cells.Style

    样式

    styleFlag

    StyleFlag

    样式枚举

    返回

    说明

      void

    1.7.2 Copy

    拷贝 range 

    void Range.Copy(range);

    名称

    值类型

    说明

    range

    Range

    返回

    说明

      void

    1.7.3 CopyStyle

    拷贝range 样式

    void Range.CopyStyle(range);

    名称

    值类型

    说明

    range

    Range

    返回

    说明

      void

    1.7.4 ExportDataTable

    导出所选择 range至DataTable中

    DataTable Range.ExportDataTable();

    名称

    值类型

    说明

    返回

    说明

      DataTable

    1.7.5 ExportDataTableAsString

    导出所选择 range数据以字符串形式导出至DataTable中

    DataTable Range.ExportDataTableAsString();

    名称

    值类型

    说明

    返回

    说明

      DataTable

    1.7.6 Merge

    合并 range 包含的所有单元格

    void Range.Merge();

    名称

    值类型

    说明

    返回

    说明

      void

    1.7.7 SetOutlineBorder

    设置 range边界线

    void Range.SetOutlineBorder(borderEdge,borderStyle,borderColor);

    名称

    值类型

    说明

    borderEdge

    BorderType —枚举

    指定边界线方向

    borderStyle

    CellBorderType —枚举

    指定边界线 线样式

    borderColor

    System.Drawing.Color

    指定边界线颜色

    返回

    说明

      void

    1.7.8 SetOutlineBorders +2

    设置 range 边界线样式(外部所有相邻单元格相邻边界线)

    void Range.SetOutlineBorders(borderStyle, borderColor);

    or

    void Range.SetOutlineBorders(borderStyles, borderColors);

    名称

    值类型

    说明

    borderStyle

    CellBorderType -枚举

    指定边界线 线样式

    borderColor

    System.Drawing.Color

    指定边界线颜色

    borderStyles

    CellBorderType[] -枚举

    borderColors

    System.Drawing.Color[]

    返回

    说明

      void

    1.7.9 UnMerge

    取消合并 range 包含的所有单元格

    void Range.UnMerge();

    名称

    值类型

    说明

    返回

    说明

      void

    1.8 Style

    Aspose.Cells.Style style = Workbook.DefaultStyle;

    Or

    Aspose.Cells.Style style = Workbook.Styles[Workbook.Styles.Add()];

    Or

    Styles styles = workbook.Styles;

    int styleIndex = styles.Add();

    Aspose.Cells.Style style = styles[styleIndex];

    属性:

    名称

    值类型

    说明

    BackgroundColor

    System.Drawing.Color

    获取或设置背景颜色

    Borders

    Borders

    获取或设置边界

    Custom

    string

    获取或设置单元格类型

    "@"-文本;"0.0%"-百分比;"0"-数值; ""$"#,##0";等

    Font

    Font

    获取或设置字体样式

    ForegroundColor

    System.Drawing.Color

    获取或设置前景颜色

    HorizontalAlignment

    TextAlignmentType -枚举

    获取或设置文本对齐方式

    IndentLevel

    int

    获取或设置缩进

    IsFormulaHidden

    bool

    获取或设置是否隐藏公式

    IsLocked

    bool

    获取或设置是否锁定

    IsTextWrapped

    bool

    获取或设置自动换行

    Name

    string

    获取或设置style名称

    Number

    int

    获取或设置数字公式

    9 –百分比;8 -¥等

    Pattern

    BackgroundType -枚举

    获取或设置背景样式

    Rotation

    int

    获取或设置字体方向

    以度为单位

    ShrinkToFit

    bool

    获取或设置缩小体填充

    TextDirection

    TextDirectionType -枚举

    获取或设置文本方向

    VerticalAlignment

    TextAlignmentType -枚举

    获取或设置垂直对齐

     1.9 StyleFlag

    StyleFlag flag = new StyleFlag();

    属性:

    名称

    值类型

    说明

    All

    bool

    设置是否应用所有样式

    Borders

    bool

    设置是否应用边界线

    BottomBorder

    bool

    设置是否应用底部边界线

    CellShading

    bool

    设置是否应用单元格底纹

    DiagonalDownBorder

    bool

    设置是否应用向下对角线

    DiagonalUpBorder

    bool

    设置是否应用向上对角线

    Font

    bool

    设置是否应用字体样式

    FontBold

    bool

    设置是否应用字体加粗

    FontColor

    bool

    设置是否应用字体颜色

    FontItalic

    bool

    设置是否应用字体斜体

    FontName

    bool

    设置是否应用字体类型

    FontScript

    bool

    设置是否应用字体脚本

    FontSize

    bool

    设置是否应用字体大小

    FontStrike

    bool

    设置是否应用字体缩小体填充

    FontUnderline

    bool

    设置是否应用字体下划线

    HideFormula

    bool

    设置是否应用隐藏公式

    HorizontalAlignment

    bool

    设置是否应用文本对齐方式

    Indent

    bool

    设置是否应用缩进

    LeftBorder

    bool

    设置是否应用左边界线

    Locked

    bool

    设置是否应用销定

    NumberFormat

    bool

    设置是否应用数字公式

    RightBorder

    bool

    设置是否应用右边界线

    Rotation

    bool

    设置是否应用 (以度为单位) 字体方向

    ShrinkToFit

    bool

    设置是否应用缩小体填充

    TextDirection

    bool

    设置是否应用文本方向

    TopBorder

    bool

    设置是否应用顶边界线

    VerticalAlignment

    bool

    设置是否应用垂直对齐

    WrapText

    bool

    设置是否应用文本换行

    1.10 DataSorter 数据分级

    DataSorter dsor = new DataSorter();

    or

    DataSorter dsor = Workbook.DataSorter; 

    属性:

    名称

    值类型

    说明

    DataSorter

    bool

    获取或设置是否敏感案例

    HasHeaders

    bool

    获取或设置是否有标题

    Key1

    int

    获取或设置一级主键

    Key2

    int

    获取或设置二级主键

    Key3

    int

    获取或设置三级主键

    Order1

    SortOrder –枚举

    获取或设置一级命令

    Order2

    SortOrder –枚举

    获取或设置二级命令

    Order3

    SortOrder –枚举

    获取或设置三级命令

    1.10.1 Clear

    void DataSorter.Clear();

    名称

    值类型

    说明

    返回

    说明

      void

    1.10.2 Sort

    排序

    void DataSorter.Sort(cells, area);

    名称

    值类型

    说明

    cells

    Cells

    area

    CellArea

    返回

    说明

      void

    1.11 AutoFilter自动筛选

    AutoFilter af = new AutoFilter ();

    Or 

    AutoFilter af = Worksheet.AutoFilter; 

    属性:

    名称

    值类型

    说明

    Range

    string

    获取或设置 range

    1.11.1 Filter

    过滤器

    void AutoFilter.Filter(fieldIndex,criteria);

    名称

    值类型

    说明

    fieldIndex

    int

    领域索引

    criteria

    string

    标准

    返回

    说明

      void

    1.11.2 Refresh

    刷新

    void AutoFilter.Refresh();

    名称

    值类型

    说明

    返回

    说明

      void

    1.11.3 SetRange

    设置过滤范围

    void AutoFilter.SetRange(Row,startColumn,endColumn);

    名称

    值类型

    说明

    Row

    int

    过滤起始行

    startColumn

    int

    过滤起始列

    endColumn

    int

    过滤结束列

    返回

    说明

      void

    1.12 Charts 图表集

    Charts charts = new Charts();

    Or 

    Charts charts = Worksheet.Charts; 

    属性:

    名称

    值类型

    说明

    Capacity

    int

    获取或设置包含元素数

    Count

    int

    获取图表数

    1.12.1 Add

    新增图表

    int Charts.Add(type,upperLeftRow,upperLeftColumn,lowerRightRow,lowerRightColumn);

    名称

    值类型

    说明

    type

    ChartType –枚举

    图表类型

    upperLeftRow

    int

    图表左上角行索引

    upperLeftColumn

    int

    图表左上角列索引

    lowerRightRow

    int

    图表右下角行索引

    lowerRightColumn

    int

    图表右下角行索引

    返回

    说明

      int

    返回图表所在集合中索引

    1.12.2 RemoveAt

    根据图表索引删除指定图表

    void Charts.RemoveAt(index);

    名称

    值类型

    说明

    index

    int

    图表索引

    返回

    说明

      void

    1.13 Chart 图表

    Chart chart = charts[int index];

    Or 

    Chart chart = charts[string name]; 

    Or

    Chart chart = Worksheet.Charts[int index];

    Or

    Chart chart = Worksheet.Charts[string name]; 

    属性:

    名称

    值类型

    说明

    0

    AutoSacling

    bool

    获取或设置三维视图格式的是否自动调整高度

    CategoryAxis

    Axis

    获取或设置分类轴

    ChartArea

    ChartArea

    获取图表区

    ChartDataTable

    ChartDataTable

    获取或设置图表数据表

    ChartObject

    ChartShape

    获取或设置图表对象

    0

    DepthPercent

    int

    获取或设置数据格式的透视深度

    0

    Elevation

    int

    获取或设置三维视图格式的上下仰角

    FirstSliceAngle

    int

    获取或设置起始片角

    有效值为0-360

    Floor

    Floor

    0

    GapDepth

    int

    获取或设置数据格式的系列间距

    0

    GapWidth

    int

    获取或设置数据格式的分类间距

    HeightPercent

    short

    获取或设置高百分比

    HidePivotFieldButtons

    bool

    获取或设置是否隐藏枢轴区哉按钮

    0

    IsDataTableShown

    bool

    获取或设置”图表选择”-是否显示数据表

    0

    IsLegendShown

    bool

    获取或设置是否显示图例

    IsRectangularCornered

    bool

    Legend

    Legend

    获取或设置图例

    MajorGridLines

    Line

    获取或设置主要网格线

    Name

    string

    获取或设置图表名称

    NSeries

    NSeries

    PageSetup

    PageSetup

    获取或设置页格局

    Perspective

    short

    获取或设置透视细数

    PivotSource

    string

    获取或设置枢轴来源

    Placement

    PlacementType –枚举

    安置

    PlotArea

    ChartFrame

    获取或设置划分区域

    PlotEmptyCellsType

    PlotEmptyCellsType –枚举

    获取或设置划分空的单元格集合类型

    PlotVisibleCells

    bool

    获取或设置是否划分可见的单元格集合

    PrintSize

    PrintSizeType –枚举

    获取或设置打印大小

    RightAngleAxes

    bool

    获取或设置右边轴角

    0

    Rotation

    int

    获取或设置三维视图格式的左右转角

    SecondCategoryAxis

    Axis

    获取或设置其次轴的分类

    SecondValueAxis

    Axis

    获取或设置其次轴的值

    SeriesAxis

    Axis

    获取或设置系列轴

    Shapes

    Shapes

    形状

    SizeWithWindow

    bool

    获取或设置大小跟随窗口

    Title

    Title

    标题

    Type

    ChartType -枚举

    获取或设置图表类型

    ValueAxis

    Axis

    获取或设置轴的值

    Walls

    Walls

    墙壁

    WallsAndGridlines2D

    bool

    获取或设置墙壁和网格线为2D

    1.13.1 Move

    将图表移至指定位置

    void Chart.Move(upperLeftRow,upperLeftColumn,lowerRightRow,lowerRightColumn);

    名称

    值类型

    说明

    upperLeftRow

    int

    左上角行

    upperLeftColumn

    int

    左上角列

    lowerRightRow

    int

    右下角行

    lowerRightColumn

    int

    右下角列

    返回

    说明

      void

    1.13.2 ToImage

    指定方式导出图表

    void Chart.ToImage();

    or

    void Chart.ToImage(imageFile);

    Or

    void Chart.ToImage(stream,jpegQuality);

    Or

    void Chart.ToImage(stream,imageFormat);

    Or

    void Chart.ToImage(imageFile,jpegQuality);

    Or

    void Chart.ToImage(imageFile, imageFormat);

    名称

    值类型

    说明

    imageFile

    string

    图片文件路径

    stream

    Stream

    jpegQuality

    long

    右下角行

    imageFormat

    System.Drawing.Imaging.ImageFormat

    右下角列

    返回

    说明

      void

    1.14 Axis分类轴

    Axis axis = new Axis();

    or

    Axis axis = Chart.CategoryAxis; 

    属性:

    名称

    值类型

    说明

    x

    AxisBetweenCategories

    bool

    获取或设置分类轴性能

    x/y

    AxisLine

    Line

    获取或设置轴线(图案-坐标轴)

    (见1.15)

    BaseUnitScale

    TimeUnit –枚举

    x

    CategoryType

    CategoryType –枚举

    TimeScale –日期

    CategoryScale –常规

    AutomaticScale –

    获取或设置分类显示类型(“数字”-“分类")

    y

    CrossAt

    double

    获取或设置刻度上交叉

    y

    Crosses

    CrossType –枚举

    Custom -取消勾选基底(xy平面) 

    Maximum -勾选基底(xy平面)交叉于最小值

    获取或设置基底(XY平面)

    y

    DisplayUnit

    DisplayUnitType –枚举

    None –无(默认)

    Hundreds -百

    Thousands -千

    Millions –百万

    Billions -十亿

    Trillions -兆

    获取或设置刻度显示单位;

    默认(None –无)

    DisplayUnitLabel

    DisplayUnitLabel 

    y

    IsLogarithmic

    bool

    获取或设置刻度下对数刻度

    x

    IsPlotOrderReversed

    bool

    分类次序反转

    x/y

    IsVisible

    bool

    获取或设置是否显示x或y轴

    LogBase

    int

    x/y

    MajorGridLines

    Line

    获取或设置主要网格线格式

    x/y

    MajorTickMark

    TickMarkType –枚举

    Outside –外部

    Cross –交叉

    Inside –内部(默认值)

    None –无

    获取或设置主要刻度线类型

    y

    MajorUnit

    double

    获取或设置刻度下主要刻度单位值

    y

    MajorUnitScale

    TimeUnit –枚举

    获取或设置Y轴主要刻度单位为最大值 按X轴最大值来定义Y轴

    y

    MaxValue

    object

    获取或设置Y轴刻度下最大值

    x/y

    MinorGridLines

    Line

    获取或设置次要网格线格式

    x/y

    MinorTickMark

    TickMarkType –枚举

    获取或设置次要刻度线类型

    y

    MinorUnit

    double

    获取或设置刻度下次要刻度单位值

    y

    MinorUnitScale

    TimeUnit –枚举

    获取或设置Y轴次要刻度单位为最大值 按X轴最大值来定义Y轴

    y

    MinValue

    object

    获取或设置Y轴刻度下最小值

    x/y

    TickLabelPosition

    TickLabelPositionType –枚举

    High –图内

    Low -图外

    NextToAxis -轴旁

    None -无

    获取或设置刻度线标签

    TickLabels

    TickLabels

    x

    TickLabelSpacing

    int

    获取或设置分类数(分类轴刻度线标签之间间距)

    x

    TickMarkSpacing

    int

    获取或设置分类数(分类轴刻度线之间间距)

    x/y

    Title

    Title

    1.15 Line轴线(坐标轴)

    Line line = Chart.CategoryAxis.AxisLine;

    Or

    Chart.CategoryAxis.AxisLine 

    Or

    Chart.ValueAxis.AxisLine

    属性:

    名称

    值类型

    说明

    Color

    System.Drawing.Color

    获取或设置(图案-坐标轴-颜色)轴线颜色

    IsVisible

    bool

    获取或设置(图案-坐标轴-)是否隐藏轴线

    True为(自动或自定义)

    False 为 (无)

    Style

    LineType –枚举

    获取或设置 图案-坐标轴-样式

    Weight

    WeightType –枚举

    获取或设置 图案-坐标轴-粗细

    1.16 TickLabels 

    TickLabels tickLabels = new TickLabels(); 

    Or

    TickLabels tickLabels = Chart.CategoryAxis.TickLabels;

    Or

    Chart.CategoryAxis.TickLabels= tickLabels;

    属性:

    名称

    值类型

    说明

    AutoScaleFont

    bool

    Background

    BackgroundMode –枚举

    Font

    Font

    x/y

    Number

    int

    获取或设置 轴-数字-分类序号

    x/y

    NumberFormat

    string

    获取或设置 轴-对齐-方向-度

    x/y

    NumberFormatLinked

    bool

    获取或设置 轴-数字-分类(正值表达式)

    x/y

    Offset

    int

    获取或设置 轴-数字-分类序号

    Rotation

    int

    TextDirection

    TextDirectionType –枚举

    下载DLL(3个版本 Aspose.Cells 17.7(.net4.0 / .net3.0)和Aspose.Cells 8.3.2.1 均为破解版)

    下载范例

  • 相关阅读:
    [SAM4N学习笔记]UART的使用
    [SAN4N学习笔记]使用SysTick精准延时
    [SAM4N学习笔记]LED点灯程序
    [SAM4N学习笔记]SAM4N工程模板搭建
    C#用大石头Xcode做数据底层注意事项
    C#MVC中@HTML中的方法
    js比较时间大小(时间为以-分割的字符串时)
    C#后台Post提交XML 及接收该XML的方法
    jq对象和DOM对象的互换
    获取和设置HTML标签中的数据
  • 原文地址:https://www.cnblogs.com/weifeng123/p/9233176.html
Copyright © 2011-2022 走看看