使用Aspose.Cells的基础知识整理
2009-01-07 14:46
519 查看
这两天用Aspose.Cells构建一个Excel报表,感觉这个组件还比较好用.记录一下常用的使用知识:
1.创建Workbook和Worksheet
validations1
Cells cells = ws.Cells;
cells[12, 0].PutValue("Please enter a number other than 0 to 10 in B1 to activate data validation:");
cells[12, 0].Style.IsTextWrapped = true;
cells[12, 1].PutValue(5);
Validations validations = totalSheet.Validations;
Validation validation = validations[validations.Add()];
//Set the data validation type
validation.Type = ValidationType.WholeNumber;
//Set the operator for the data validation
validation.Operator = OperatorType.Between;
//Set the value or expression associated with the data validation
validation.Formula1 = "0";
//the value or expression associated with the second part of the data validation
validation.Formula2 = "10";
validation.ShowError = true;
//Set the validation alert style
validation.AlertStyle = ValidationAlertType.Information;
//Set the title of the data-validation error dialog box
validation.ErrorTitle = "Error";
//Set the data validation error message
validation.ErrorMessage = " Enter value between 0 to 10";
//Set the data validation input message
validation.InputMessage = "Data Validation using Condition for Numbers";
validation.IgnoreBlank = true;
validation.ShowInput = true;
validation.ShowError = true;
//设置Validations的区域,因为现在要Validations的位置是12,1,所以下面设置对应的也要是12,1
CellArea cellArea;
cellArea.StartRow = 12;
cellArea.EndRow = 12;
cellArea.StartColumn = 1;
cellArea.EndColumn = 1;
validation.AreaList.Add(cellArea);
/*
要注意 的地方Validations 也是和Range的Style一样,要新增的,否则不生效
*/
上边不过是基础中的基础,要了解更多就要自己不断的尝试了.下边奉上帮助文档和DLL:
点击这里下载!
附送Excel支持的56种颜色: Excel报表支持的56种颜色(Excel2003及以下版本)
1.创建Workbook和Worksheet
validations1
Cells cells = ws.Cells;
cells[12, 0].PutValue("Please enter a number other than 0 to 10 in B1 to activate data validation:");
cells[12, 0].Style.IsTextWrapped = true;
cells[12, 1].PutValue(5);
Validations validations = totalSheet.Validations;
Validation validation = validations[validations.Add()];
//Set the data validation type
validation.Type = ValidationType.WholeNumber;
//Set the operator for the data validation
validation.Operator = OperatorType.Between;
//Set the value or expression associated with the data validation
validation.Formula1 = "0";
//the value or expression associated with the second part of the data validation
validation.Formula2 = "10";
validation.ShowError = true;
//Set the validation alert style
validation.AlertStyle = ValidationAlertType.Information;
//Set the title of the data-validation error dialog box
validation.ErrorTitle = "Error";
//Set the data validation error message
validation.ErrorMessage = " Enter value between 0 to 10";
//Set the data validation input message
validation.InputMessage = "Data Validation using Condition for Numbers";
validation.IgnoreBlank = true;
validation.ShowInput = true;
validation.ShowError = true;
//设置Validations的区域,因为现在要Validations的位置是12,1,所以下面设置对应的也要是12,1
CellArea cellArea;
cellArea.StartRow = 12;
cellArea.EndRow = 12;
cellArea.StartColumn = 1;
cellArea.EndColumn = 1;
validation.AreaList.Add(cellArea);
/*
要注意 的地方Validations 也是和Range的Style一样,要新增的,否则不生效
*/
上边不过是基础中的基础,要了解更多就要自己不断的尝试了.下边奉上帮助文档和DLL:
点击这里下载!
附送Excel支持的56种颜色: Excel报表支持的56种颜色(Excel2003及以下版本)
相关文章推荐
- 使用Aspose.Cells的基础知识整理
- 使用Aspose.Cells的基础知识整理
- 使用Aspose.Cells的基础知识整理
- 使用Aspose.Cells的基础知识整理 .
- 使用Aspose.Cells的基础知识整理[转]
- [转]使用Aspose.Cells的基础知识整理
- 使用Aspose.Cells的基础知识整理
- 使用Aspose.Cells的基础知识整理
- 使用Aspose.Cells的基础知识整理
- Aspose.Cells基础使用方法整理
- 【转】Aspose.Cells基础使用方法整理
- 使用Aspose.Word的基础知识整理
- Aspose.Cells基础使用方法整理
- Aspose.Cells基础使用方法整理
- python基础知识整理——urllib2的高级使用
- ||C||<基础>C语言基础知识框架结构//个人整理使用|仅供参考|
- 网络的使用-安卓基础知识整理
- Activity详解、Intent使用、Fragment详解-Android基础知识整理
- 使用Aspose.Cells 过程中用过的知识(转)
- 使用Aspose.Cells 过程中用过的知识