java工具类之导出Excel 深碍√TFBOYSˉ_ 2022-08-20 12:26 266阅读 0赞 在我们的项目中经常会用到导出excel,这里就列举一下大家最常用到的导出EXCEL技术,在说一下自己设计的工具类。对POI不感兴趣的人,可以直接跳到最下面的工具类; **什么是Apache POI?** **Apache POI是一种流行的API,它允许程序员使用Java程序创建,修改和显示MS Office文件。这由Apache软件基金会开发使用Java分布式设计或修改Microsoft Office文件的开源库。它包含类和方法对用户输入数据或文件到MS Office文档进行解码。** ## Apache POI组件 ## Apache POI包含类和方法,来将MS Office所有OLE 2文档复合。此API组件的列表如下。 * * POIFS (较差混淆技术实现文件系统) : 此组件是所有其他POI元件的基本因素。它被用来明确地读取不同的文件。 * HSSF (可怕的电子表格格式) : 它被用来读取和写入MS-Excel文件的xls格式。 * XSSF (XML格式) : 它是用于MS-Excel中XLSX文件格式。 * HPSF (可怕的属性设置格式) : 它用来提取MS-Office文件属性设置。 * HWPF (可怕的字处理器格式) : 它是用来读取和写入MS-Word的文档扩展名的文件。 * XWPF (XML字处理器格式) : 它是用来读取和写入MS-Word的docx扩展名的文件。 * HSLF (可怕的幻灯片版式格式) : 它是用于读取,创建和编辑PowerPoint演示文稿。 * HDGF (可怕的图表格式) : 它包含类和方法为MS-Visio的二进制文件。 * HPBF (可怕的出版商格式) : 它被用来读取和写入MS-Publisher文件. * ## Java Aspose Cells ## Java Aspose Cells 是一种纯粹的Java授权的Excel API,开发和供应商Aspose发布。这个API的最新版本是8.1.2,发布于2014年7月,是一个丰富而厚重的API(普通Java类和AWT类的组合)设计,可以读、写和操纵电子表格Excel的组件。此API常见用途如下: * Excel报表,建立动态Excel报表 * 高保真的Excel渲染和打印 * 从Excel电子表格中导入和导出数据 * 生成,编辑,转换和电子表格 ## JXL ## JXL是一款专为Selenium第三方框架,支持基于Web浏览器(数据是Web浏览器自动更新)数据驱动的自动化。然而,它也被用来作为JExcel API的一个共同的支持库,因为它的基本功能是可创建,读取和写入电子表格。基本特征如下: * 生成Excel文件 * 从工作簿和电子表格导入数据 * 获得行和列的总数 注意:JXL只支持xls档案格式,并且不能处理大数据量。 ## JExcel ## JExcel是由Team Dev开发提供纯行货API。利用这一点程序员可以很容易地读取,写入,显示和修改Excel工作簿中的两种格式:.xls和.XLSX。这个API可以很容易地嵌入Java的Swing和AWT。这个API的最新版本是Jexcel-2.6.12,发布于2009年,主要特点如下。 * 自动化Excel应用程序,工作簿,工作表等 * 在Java Swing应用程序作为普通的Swing组件嵌入到工作簿 * 事件侦听器添加到工作簿和电子表格 * 添加事件处理程序来处理的工作簿和电子表格事件的行为 * 添加本地对等开发定制功能 ## Apache POI ## Apache POI是Apache软件基金会提供的100%开源库。大多数中小规模的应用程序开发主要依赖于Apache POI(HSSF+ XSSF)。它支持Excel 库的所有基本功能; 然而,呈现和文本提取是它的主要特点。 这是创建或维护Excel工作簿的所有类的超接口。它属于org.apache.poi.ss.usermodel包。是实现此接口的两个类,如下所示: * HSSFWorkbook : 这个类有读取和.xls 格式和写入Microsoft Excel文件的方法。它与微软Office97-2003版本兼容。 * XSSFWorkbook : 这个类有读写Microsoft Excel和OpenOffice的XML文件的格式.xls或.xlsx的方法。它与MS-Office版本2007或更高版本兼容。 ## HSSFWorkbook ## 它是在org.apache.poi.hssf.usermodel包的高层次的类。它实现了Workbook 接口,用于Excel文件中的.xls格式。下面列出的是一些本类下的方法和构造函数。 ### 类的构造函数 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 构造函数和说明</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFWorkbook()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 从头开始创建一个新的HSSFWorkbook对象时。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFWorkbook(DirectoryNode directory, boolean preserveNodes)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个特定的目录中一个新的HSSFWworkbook对象。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFWorkbook(DirectoryNode directory, POIFSFileSystem fs, boolean preserveNodes)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 给定一个POIFSFileSystem对象和特定的目录中,它创建了一个SSFWorkbook对象读取指定的工作簿。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 4</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFWorkbook(java.io.InputStream s)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建使用输入流中的新HSSFWorkbook对象时。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 5</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFWorkbook(java.io.InputStream s, boolean preserveNodes)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 构建在输入流的POI文件系统。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 6</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFWorkbook(POIFSFileSystem fs)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 使用POIFSFileSystem对象构造的新HSSFWorkbook对象时。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 7</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFWorkbook(POIFSFileSystem fs, boolean preserveNodes)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 给定一个POIFSFileSystem对象时,它会创建一个新的HSSFWorkbook对象时读取指定的工作簿。</p> </td> </tr> </tbody> </table> 这些构造内的常用参数: * directory : 这是从POI文件系统处理的目录。 * fs :它是包含簿流该POI的文件系统。 * preservenodes : 这是决定是否保留其他节点像宏的可选参数。它消耗大量的内存,因为它存储在内存中的所有POIFileSystem(如果设置)。 注意:HSSFWorkbook类包含了许多方法;然而,它们仅与XLS格式兼容。在本教程中,重点是在Excel文件格式的最新版本。因此,HSSFWorkbook类的方法,这里没有列出。如果需要这些类的方法,那么请参照POI-HSSFWorkbook类API在 [https://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFWorkbook.html.][https_poi.apache.org_apidocs_org_apache_poi_hssf_usermodel_HSSFWorkbook.html.] ## XSSFWorkbook ## 它是用于表示高和低层次Excel文件格式的类。它属于org.apache.xssf.usemodel包,并实现Workbook接口。下面列出的是这个类的方法和构造函数。 ### 类的构造函数 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 构造函数和说明</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFWorkbook()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 从头开始创建一个新的XSSFworkbook对象。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFWorkbook(java.io.File file)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 构造从给定文件中的XSSFWorkbook对象。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFWorkbook(java.io.InputStream is)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 构造一个XSSFWorkbook对象,通过缓冲整个输入流到内存中,然后为它打开一个OPCPackage对象。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 4</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFWorkbook(java.lang.String path)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 构建一个给定文件的完整路径的XSSFWorkbook对象。</p> </td> </tr> </tbody> </table> ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法及描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">createSheet()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个XSSFSheet本工作簿,将其添加到表,并返回高层表示。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">createSheet(java.lang.String sheetname)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建此工作簿的新表,并返回高层表示。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">createFont()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个新的字体,并将其添加到工作簿的字体表。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 4</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">createCellStyle()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个新的XSSFCellStyle并将其添加到工作簿的样式表。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 5</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">createFont()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个新的字体,并将其添加到工作簿的字体表。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 6</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setPrintArea(int sheetIndex, int startColumn, int endColumn, int startRow,int endRow)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置一个给定的表按照指定参数的打印区域。</p> </td> </tr> </tbody> </table> 对于此类的其余的方法,请参阅完整的API文档:[http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFWorkbook.html.][http_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFWorkbook.html.] 列出了所有方法。 ## Sheet ## Sheet是在org.apache.poi.ss.usermodel包的接口,它是创建具有特定名称的高或低级别的电子表格的所有类的超接口。电子表格的最常见的类型是工作表,它被表示为单元的网格。 ## HSSFSheet ## 这是在org.apache.poi.hssf.usermodel包的类。它可以创建Excel电子表格,它允许在sheet 方式和表数据格式。 ### 类的构造函数 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 构造函数及描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFSheet(HSSFWorkbook workbook)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建新HSSFSheet通过调用HSSFWorkbook从头开始创建一个表。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">HSSFSheet(HSSFWorkbook workbook, InternalSheet sheet)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建HSSFSheet表示给定表对象。</p> </td> </tr> </tbody> </table> ## XSSFSheet ## 这是代表了Excel电子表格的高级别代表的一类。这在org.apache.poi.hssf.usermodel包下。 ### 类的构造函数 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 构造函数及描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFSheet()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创造了新的XSSFSheet- 调用XSSFWorkbook从头开始创建一个表。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFSheet(PackagePart part, PackageRelationship rel)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建XSSFSheet表示给定包的一部分和关系。</p> </td> </tr> </tbody> </table> ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法和描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">addMergedRegion(CellRangeAddress region)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 添加单元的合并区域(因此这些单元格合并形成一个)。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">autoSizeColumn(int column)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 调整列宽,以适应的内容。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">iterator()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 此方法是用于rowIterator()的别名,以允许foreach循环</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 4</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">addHyperlink(XSSFHyperlink hyperlink)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 注册超链接的集合中的超链接此工作表格上</p> </td> </tr> </tbody> </table> 对于此类的其余的方法,请参阅完整的API在: [https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFSheet.html.][https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFSheet.html.] ## 行 ## 这是在org.apache.poi.ss.usermodel包的接口。它是用于一排的电子表格的高层表示。它是代表了POI库的行所有类的超接口。 ## XSSFRow ## 这是在org.apache.poi.xssf.usermodel包的类。它实现了Row接口,因此它可以在电子表格中创建行。下面列出的是这个类在方法和构造函数。 ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">createCell(int columnIndex)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建新单元行并返回。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setHeight(short height)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置短单位的高度。</p> </td> </tr> </tbody> </table> 对于此类的其余的方法,参考如下链接: [https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFRow.html][https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFRow.html] ## 单元格 ## 这是在org.apache.poi.ss.usermodel包的接口。它是代表了单元在电子表格中的行中的所有类的超接口。 单元格可以使用各种属性,例如空白,数字,日期,错误等单元格被添加到一个行之前应具有(基于0)自己的编号。 ## XSSFCell ## 这是在 org.apache.poi.xssf.usermodel 包的类。它实现了单元格界面。它是单元在电子表格中的行的一个高层次的表示。 ## 字段摘要 ## 下面列出的是一些XSSFCell类的字段以及它们的描述。 <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 单元格类型</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> CELL_TYPE_BLANK</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 代表空白单元格</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> CELL_TYPE_BOOLEAN</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 代表布尔单元(true或false)</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> CELL_TYPE_ERROR</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 表示在单元的误差值</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> CELL_TYPE_FORMULA</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 表示一个单元格公式的结果</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> CELL_TYPE_NUMERIC</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 表示对一个单元的数字数据</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> CELL_TYPE_STRING</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 表示对一个单元串(文本)</td> </tr> </tbody> </table> ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setCellStyle(CellStyle style)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 为单元格设置样式。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setCellType(int cellType)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置单元格的类型(数字,公式或字符串)。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setCellValue(boolean value)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置单元格一个布尔值</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 4</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setCellValue(java.util.Calendar value)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置一个日期值的单元格。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 5</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setCellValue(double value)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置为单元格的数值。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 6</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setCellValue(java.lang.String str)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置为单元格的字符串值。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 7</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setHyperlink(Hyperlink hyperlink)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 分配超链接到该单元格。</p> </td> </tr> </tbody> </table> 对于这个类的剩余方法和字段,请访问以下链接查看详细: [https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFCell.html][https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFCell.html] ## XSSFCellStyle ## 这是在org.apache.poi.xssf.usermodel包的类。它将提供关于在电子表格的单元格中的内容的格式可能的信息。它也提供了用于修正该格式的选项。它实现了CellStyle接口。 ### 字段摘要 ### 下表列出了从CellStyle接口继承一些字段。 <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 字段名称</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 字段描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> ALIGN_CENTER</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 中心对齐单元格内容</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> ALIGN_CENTER_SELECTION</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 中心选择水平对齐方式</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> ALIGN_FILL</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 单元格适应于内容的大小</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> ALIGN_JUSTIFY</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 适应单元格内容的宽度</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> ALIGN_LEFT</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 左对齐单元格内容</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> ALIGN_RIGHT</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 右对齐单元格内容</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> BORDER_DASH_DOT</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 使用破折号和点单元格样式</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> BORDER_DOTTED</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 用虚线边框的单元格样式</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> BORDER_DASHED</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 用虚线边框的单元格样式</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> BORDER_THICK</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 厚厚的边框单元格样式</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> BORDER_THIN</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 薄边框的单元格样式</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> VERTICAL_BOTTOM</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 对齐单元格内容的垂直下方</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> VERTICAL_CENTER</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 对齐单元格内容垂直居中</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> VERTICAL_JUSTIFY</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 对齐和垂直对齐的单元格内容</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> VERTICAL_TOP</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 顶部对齐为垂直对齐</td> </tr> </tbody> </table> ### 类的构造函数 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 构造函数及描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFCellStyle(int cellXfId, int cellStyleXfId, StylesTable stylesSource, ThemesTable theme)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个单元格样式,从所提供的部分</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFCellStyle(StylesTable stylesSource)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个空的单元样式</p> </td> </tr> </tbody> </table> ### 类方法 ### 设置边框的类型为单元格的底部边界 <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法及描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setAlignment(short align)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置<span style="background-color:transparent">单元格为</span><span style="background-color:transparent">水平对齐的类型</span></p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setBorderBottom(short border)</span></p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setBorderColor(XSSFCellBorder.BorderSide side, XSSFColor color)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 选定的边框颜色</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 4</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setBorderLeft(Short border)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置边界的类型单元格的左边框</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 5</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setBorderRight(short border)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置边框的类型为单元格的右边界</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 6</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setBorderTop(short border)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置边界的类型的单元上边框</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 7</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setFillBackgroundColor(XSSFColor color)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置表示为XSSFColor值背景填充颜色。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 8</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setFillForegroundColor(XSSFColor color)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置表示为XSSFColor的值前景填充颜色。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 9</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setFillPattern(short fp)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 指定单元格的填充信息模式和纯色填充单元。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 10</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setFont(Font font)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置此样式的字体。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 11</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setRotation(short rotation)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置的旋转为在单元格中文本的程度。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 12</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setVerticalAlignment(short align)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置单元类型为<span style="background-color:transparent">垂直取向</span><span style="background-color:transparent">。</span></p> </td> </tr> </tbody> </table> 对于这个类剩下的方法和字段,通过以下链接: [https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFCellStyle.html][https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFCellStyle.html] ## HSSFColor ## 这是在org.apache.poi.hssf.util包的类。它提供了不同的颜色作为嵌套类。通常这些嵌套类是使用自己的索引来表示。它实现了Color接口。 ### 嵌套类 ### 所有嵌套类这个类是静态的,每个类都有其索引。这些嵌套色类用于单元格格式,如单元格内容,边框,前景和背景。下面列出了一些的嵌套类。 <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 类名(颜色)</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.AQUA</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.AUTOMATIC</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.BLACK</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 4</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.BLUE</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 5</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.BRIGHT_GREEN</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 6</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.BRIGHT_GRAY</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 7</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.CORAL</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 8</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.DARK_BLUE</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 9</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.DARK_GREEN</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 10</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.SKY_BLUE</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 11</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.WHITE</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 12</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> HSSFColor.YELLOW</td> </tr> </tbody> </table> ### 类方法 ### 这个类的只有一个方法是很重要的,并且用于获取索引值。 <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法和描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">getIndex()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 这种方法被用来获得一个嵌套类的索引值</p> </td> </tr> </tbody> </table> 对于其余的方法和嵌套类,请参阅以下链接: [https://poi.apache.org/apidocs/org/apache/poi/hssf/util/HSSFColor.html.][https_poi.apache.org_apidocs_org_apache_poi_hssf_util_HSSFColor.html.] ## XSSFColor ## 这是在org.apache.poi.xssf.usermodel包的类。它是用来表示在电子表格中的颜色。它实现了颜色的接口。下面列出的是它的一些方法和构造函数。 ### 类的构造函数 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> Constructor and 描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFColor()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建XSSFColor的新实例。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFColor(byte[] rgb)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建XSSFColor使用RGB的新实例。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFColor(java.awt.Color clr)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建XSSFColor使用Color类从AWT包的新实例。</p> </td> </tr> </tbody> </table> ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法和描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setAuto(boolean auto)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置一个布尔值,表示ctColor是自动的,系统ctColor依赖。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setIndexed(int indexed)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置索引ctColor值系统ctColor。</p> </td> </tr> </tbody> </table> 对于其余的方法,请访问以下链接: [https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFColor.html.][https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFColor.html.] ## XSSFFont ## 这是在org.apache.poi.xssf.usermodel包的类。它实现了Font接口,因此它可以处理工作簿中不同的字体。 ### 类的构造函数 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 构造函数和描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">XSSFFont()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个新的XSSFont实例。</p> </td> </tr> </tbody> </table> ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法和描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setBold(boolean bold)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置“bold”属性的布尔值。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setColor(short color)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置索引颜色的字体。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setColor(XSSFColor color)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置为标准Alpha RGB颜色值的字体颜色。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 4</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setFontHeight(short height)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置在点的字体高度。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 5</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setFontName(java.lang.String name)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置字体的名称。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 6</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setItalic(boolean italic)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置“italic”属性一个布尔值。</p> </td> </tr> </tbody> </table> 对于其余的方法,通过以下链接: [https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFFont.html.][https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFFont.html.] ## XSSFHyperlink ## 这是在org.apache.poi.xssf.usermodel包的类。它实现了Hyperlink接口。它是用来连结设置为电子表格的单元格内容。 ### 字段 ### 属于此类的字段如下。这里,字段意味着使用超链接的类型。 <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 字段</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> LINK_DOCUMENT</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 用于连接任何其他文件</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> LINK_EMAIL</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 用于链接的电子邮件</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> LINK_FILE</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 用于以任何格式链接任何其他文件</td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> LINK_URL</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 用来连接一个网页URL</td> </tr> </tbody> </table> ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法及描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setAddress(java.lang.String address)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 超链接地址。</p> </td> </tr> </tbody> </table> 对于其余的方法,请访问以下链接: [https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFHyperlink.html][https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFHyperlink.html] ## XSSFCreationHelper ## 这是在org.apache.poi.xssf.usermodel包的类。它实现了CreationHelper接口。它被用作公式求值和设置超文本链接支持类。 ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法和描述</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">createFormulaEvaluator()</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 创建一个XSSFFormulaEvaluator例如,结果计算公式的单元格的对象。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">createHyperlink(int type)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> Creates a new XSSFHyperlink.</p> </td> </tr> </tbody> </table> 对于其余的方法,请参考以下链接:[https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFCreationHelper.html.][https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFCreationHelper.html.] ## XSSFPrintSetup ## 这是在org.apache.poi.xsssf.usermodel包下的类。它实现了PrintSetup接口。它是用来设置打印页面大小,面积,选项和设置。 ### 类方法 ### <table style="font-family:'Open Sans',Arial,sans-serif; font-size:14px; border-collapse:collapse; border-spacing:0px; max-width:100%; background-color:transparent; margin:8px 0px 20px; padding:0px; border:1px solid rgb(221,221,221); vertical-align:top; color:rgb(49,49,49); width:604px; line-height:22px"> <tbody style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:16px"> <tr style=""> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> S.No.</th> <th style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; margin:0px; border-collapse:collapse; background-color:rgb(238,238,238); border:1px solid rgb(221,221,221); line-height:1.42857143; vertical-align:top"> 方法及说明</th> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 1</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setLandscape(boolean ls)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置一个布尔值,允许或阻止横向打印。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 2</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setLeftToRight(boolean ltor)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置是否向左走向右或自上而下的顺序,同时打印。</p> </td> </tr> <tr style=""> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> 3</td> <td style="font-family:'Open Sans',Arial,'Hiragino Sans GB','Microsoft YaHei',微软雅黑,STHeiti,'WenQuanYi Micro Hei',SimSun,sans-serif,sans-serif; font-size:11pt; padding:8px; line-height:1.42857143; vertical-align:top; border:1px solid rgb(221,221,221)"> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> <span style="font-weight:700">setPaperSize(short size)</span></p> <p style="font-size:16px; margin:0em 0.2em 1em; color:rgb(0,0,0); line-height:24px; padding-top:0px; padding-bottom:0px; text-align:justify"> 设置纸张尺寸。</p> <div> <br> </div> </td> </tr> </tbody> </table> 每个系统附带一个很大的字体如 Arial, Impact, Times New Roman,等字体集合也可以用新的字体更新,如果需要的话。同样也有各种风格,其中的字体可以显示,例如,粗体,斜体,下划线,删除线等。 ## 字体和字体样式 ## 下面的代码用于特定的字体和样式应用于一单元格的内容。 import java.io.File; import java.io.FileOutputStream; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFFont; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class FontStyle { public static void main(String[] args)throws Exception { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet spreadsheet = workbook.createSheet("Fontstyle"); XSSFRow row = spreadsheet.createRow(2); //Create a new font and alter it. XSSFFont font = workbook.createFont(); font.setFontHeightInPoints((short) 30); font.setFontName("IMPACT"); font.setItalic(true); font.setColor(HSSFColor.BRIGHT_GREEN.index); //Set font into style XSSFCellStyle style = workbook.createCellStyle(); style.setFont(font); // Create a cell with a value and set style to it. XSSFCell cell = row.createCell(1); cell.setCellValue("Font Style"); cell.setCellStyle(style); FileOutputStream out = new FileOutputStream( new File("fontstyle.xlsx")); workbook.write(out); out.close(); System.out.println( "fontstyle.xlsx written successfully"); } } 让我们保存上面的代码在一个名为FontStyle.java文件。从命令提示符编译并执行它如下。 $javac FontStyle.java $java FontStyle 它生成一个名为fontstyle.xlsx在当前目录中的Excel文件并显示在命令提示符处键入以下输出。 fontstyle.xlsx written successfully fontstyle.xlsx文件如下所示。 ![FontStyle][] ## 文字方向 ## 在这里,可以学习如何设置不同角度的文本方向。通常单元格的内容以水平方式显示,由左到右,并在00角;但是可以使用下面的代码来旋转文本的方向(如果需要的话)。 import java.io.File; import java.io.FileOutputStream; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class TextDirection { public static void main(String[] args)throws Exception { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet spreadsheet = workbook.createSheet( "Text direction"); XSSFRow row = spreadsheet.createRow(2); XSSFCellStyle myStyle = workbook.createCellStyle(); myStyle.setRotation((short) 0); XSSFCell cell = row.createCell(1); cell.setCellValue("0D angle"); cell.setCellStyle(myStyle); //30 degrees myStyle=workbook.createCellStyle(); myStyle.setRotation((short) 30); cell = row.createCell(3); cell.setCellValue("30D angle"); cell.setCellStyle(myStyle); //90 degrees myStyle=workbook.createCellStyle(); myStyle.setRotation((short) 90); cell = row.createCell(5); cell.setCellValue("90D angle"); cell.setCellStyle(myStyle); //120 degrees myStyle=workbook.createCellStyle(); myStyle.setRotation((short) 120); cell = row.createCell(7); cell.setCellValue("120D angle"); cell.setCellStyle(myStyle); //270 degrees myStyle = workbook.createCellStyle(); myStyle.setRotation((short) 270); cell = row.createCell(9); cell.setCellValue("270D angle"); cell.setCellStyle(myStyle); //360 degrees myStyle=workbook.createCellStyle(); myStyle.setRotation((short) 360); cell = row.createCell(12); cell.setCellValue("360D angle"); cell.setCellStyle(myStyle); FileOutputStream out = new FileOutputStream( new File("textdirection.xlsx")); workbook.write(out); out.close(); System.out.println( "textdirection.xlsx written successfully"); } } 保持TextDirectin.java文件上面的代码,然后编译并从命令提示符如下执行它。 $javac TextDirection.java $java TextDirection 这将编译和执行,以生成一个名为textdirection.xlsx在当前目录中的Excel文件并显示在命令提示符处键入以下输出。 textdirection.xlsx written successfully 面的代码演示如何创建单元格的超链接。 import java.io.File; import java.io.FileOutputStream; import org.apache.poi.common.usermodel.Hyperlink; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.CreationHelper; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFFont; import org.apache.poi.xssf.usermodel.XSSFHyperlink; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class HyperlinkEX { public static void main(String[] args) throws Exception { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet spreadsheet = workbook .createSheet("Hyperlinks"); XSSFCell cell; CreationHelper createHelper = workbook .getCreationHelper(); XSSFCellStyle hlinkstyle = workbook.createCellStyle(); XSSFFont hlinkfont = workbook.createFont(); hlinkfont.setUnderline(XSSFFont.U_SINGLE); hlinkfont.setColor(HSSFColor.BLUE.index); hlinkstyle.setFont(hlinkfont); //URL Link cell = spreadsheet.createRow(1) .createCell((short) 1); cell.setCellValue("URL Link"); XSSFHyperlink link = (XSSFHyperlink)createHelper .createHyperlink(Hyperlink.LINK_URL); link.setAddress("http://www.yiibai.com/" ); cell.setHyperlink((XSSFHyperlink) link); cell.setCellStyle(hlinkstyle); //Hyperlink to a file in the current directory cell = spreadsheet.createRow(2) .createCell((short) 1); cell.setCellValue("File Link"); link = (XSSFHyperlink)createHelper .createHyperlink(Hyperlink.LINK_FILE); link.setAddress("cellstyle.xlsx"); cell.setHyperlink(link); cell.setCellStyle(hlinkstyle); //e-mail link cell = spreadsheet.createRow(3) .createCell((short) 1); cell.setCellValue("Email Link"); link = (XSSFHyperlink)createHelper .createHyperlink(Hyperlink.LINK_EMAIL); link.setAddress( "mailto:contact@yiibai.com?" +"subject=Hyperlink"); cell.setHyperlink(link); cell.setCellStyle(hlinkstyle); FileOutputStream out = new FileOutputStream( new File("hyperlink.xlsx")); workbook.write(out); out.close(); System.out.println("hyperlink.xlsx written successfully"); } } 保存上面的代码到文件HyperlinkEX.java。并从命令提示符编译执行它如下。 $javac HyperlinkEX.java $java HyperlinkEX 它会生成一个名为hyperlink.xlsx在当前目录中的Excel文件并显示在命令提示符处输出: hyperlink.xlsx written successfully hyperlink.xlsx文件如下所示。 ![Hyperlink][] * 注以上内容转载自http://www.yiibai.com/apache\_poi/apache\_poi\_hyperlink.html * 下面将说一下自己设计的工具类; * 工具类一般有两种,一种是页面使用表单提交,后台接收参数,然后去数据库查询出来结果,再导出下载;另外一种是页面是一个按钮点击出发js事件,js拼装一个ifram,在ifram里面发一个URL请求,并且封装参数 * 1:表单提交 * </form> <form id="excelForm" method="post" action="../../manage/orderExportExcel.do"> <input id="orderCode" name="ids" value="" type="hidden"> <div align="center"><button id="btn" class="btn btn-info" >批量导出</button></div> </form> public class ExcelUtil { /** * 功能描述:excel生成工具 */ public static <T> void toExcelOutStream(OutputStream out, String codedFileName, List<ExcelVo> header, List<T> datas,HttpServletResponse response,String path) { try { String oldCodedFileName = codedFileName; // 产生工作簿对象 SXSSFWorkbook workbook = new SXSSFWorkbook(100); // 产生工作表对象 int sheetNum = 1; Sheet sheet = workbook .createSheet(codedFileName + "-" + sheetNum++); // 进行转码,使其支持中文文件名 codedFileName = java.net.URLEncoder .encode(codedFileName + DateUtils .getNowTime("yyyy_MM_dd_hh_mm_ss"), "UTF-8"); generateExcelHeader(sheet, header, workbook); // 插入数据 Field field; int sheetLength = 0; int rowNum = 1; for (int i = 1; i <= datas.size(); i++) { T obj = datas.get(i - 1); if (obj != null) { // 加入超过单个Sheet的最大长度,则新城一个新的sheet页 sheetLength++; if (sheetLength >= 65535) { sheetLength = 0; rowNum = 1; sheet = workbook.createSheet(oldCodedFileName + "-" + sheetNum++); generateExcelHeader(sheet, header, workbook); } Row row = sheet.createRow(rowNum++);// 创建一行 for (int j = 0; j < header.size(); j++) { Cell cell = row.createCell(j);// 创建一列 cell.setCellType(header.get(j).getRowType()); field = obj.getClass().getDeclaredField( header.get(j).getRowNameEg()); field.setAccessible(true);Object value=new Object(); if(field.get(obj)!=null&&!"".equals(field.get(obj))){ if(field.getType().getSimpleName().equals("Date")){ value = field.get(obj); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd H:m:s"); value=format.format(value); }else{ value = field.get(obj); } setCellValue(cell, value, header.get(j).getRowType()); } } } } workbook.write(out); out.flush(); download(path, response); } catch (Exception e) { e.printStackTrace(); } finally { try { if (out != null) { out.close(); } } catch (IOException e) { e.printStackTrace(); } } } private static void generateExcelHeader(Sheet sheet, List<ExcelVo> header, SXSSFWorkbook workbook) { // 单元格样式 CellStyle headerStyle = workbook.createCellStyle(); // 字体样式 Font font = workbook.createFont(); font.setFontHeightInPoints((short) 12); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); headerStyle.setFont(font); // 生成头行 if (header != null && header.size() > 0) { Row row = sheet.createRow(0);// 创建一行 for (int i = 0; i < header.size(); i++) { Cell cell = row.createCell(i);// 创建一列 cell.setCellType(header.get(i).getRowType()); cell.setCellValue(header.get(i).getRowNameCn()); cell.setCellStyle(headerStyle); sheet.setColumnWidth(i, header.get(i).getCellWith()); } } } /** * @param response * 响应流 * @param codedFileName * 文件名称,默认生成时间戳格式 * @param header * 头行数据 * @param datas * 表格数据 */ public static <T> void toExcelOutStream(HttpServletResponse response, String codedFileName, List<ExcelVo> header, List<T> datas) { // 生成提示信息, response.setContentType("application/vnd.ms-excel"); response.setHeader("content-disposition", "attachment;filename=" + codedFileName); try { toExcelOutStream(response.getOutputStream(), codedFileName, header, datas,response,null); } catch (IOException e) { e.printStackTrace(); } } public static void excel(HttpServletResponse response) throws FileNotFoundException{ FileOutputStream file=new FileOutputStream("C:\\Users\\liaoyongguang\\student1.xls"); List ls=new ArrayList(); List<ExcelVo> le=new ArrayList<ExcelUtil.ExcelVo>(); for(int i=0;i<=5;i++){ Student st=new Student("张三"+i,i,"湖北襄阳"+i); ls.add(st); } ExcelVo ev=new ExcelVo("姓名",HSSFCell.CELL_TYPE_STRING, "name"); ExcelVo ev1=new ExcelVo("年龄",HSSFCell.CELL_TYPE_STRING, "age"); ExcelVo ev2=new ExcelVo("地址",HSSFCell.CELL_TYPE_STRING, "address"); le.add(ev); le.add(ev1); le.add(ev2); } /** * @param cell * 单元格 * @param value * 值 * @param cellType * 单元格类型 设置单元格的值 */ private static void setCellValue(Cell cell, Object value, int cellType) { if (cellType == HSSFCell.CELL_TYPE_STRING) { cell.setCellValue(String.valueOf(value)); } else if (cellType == HSSFCell.CELL_TYPE_NUMERIC) { cell.setCellValue((Double) value); } else if (cellType == HSSFCell.CELL_TYPE_BOOLEAN) { cell.setCellValue((Boolean) value); } else if (cellType == HSSFCell.CELL_TYPE_BLANK) { cell.setCellValue(""); } } /*/ * 以下载的方式读取excel */ private static void download(String path, HttpServletResponse response) { try { // path是指欲下载的文件的路径。 File file = new File(path); // 取得文件名。 String filename = file.getName(); // 以流的形式下载文件。 InputStream fis = new BufferedInputStream(new FileInputStream(path)); byte[] buffer = new byte[fis.available()]; fis.read(buffer); fis.close(); // 清空response response.reset(); // 设置response的Header response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes())); response.addHeader("Content-Length", "" + file.length()); OutputStream toClient = response.getOutputStream(); response.setContentType("application/vnd.ms-excel"); // contentDisposition toClient.write(buffer); toClient.flush(); toClient.close(); } catch (IOException ex) { ex.printStackTrace(); } } /** * @Author * @Date 下午3:30:28 生成excel所需的头信息 */ public static class ExcelVo { public ExcelVo(String rowNameCn, int rowType, String rowNameEg) { this.rowNameCn = rowNameCn; this.rowNameEg = rowNameEg; this.rowType = rowType; } /** * 字段中文描述 */ private String rowNameCn; /** * 字段类型 * */ private int rowType; /** * 字段名 * */ private String rowNameEg; /** * 列宽 * */ private int cellWith = 25 * 256; public String getRowNameCn() { return rowNameCn; } public void setRowNameCn(String rowNameCn) { this.rowNameCn = rowNameCn; } public int getRowType() { return rowType; } public void setRowType(int rowType) { this.rowType = rowType; } public String getRowNameEg() { return rowNameEg; } public void setRowNameEg(String rowNameEg) { this.rowNameEg = rowNameEg; } public int getCellWith() { return cellWith; } public void setCellWith(int cellWith) { this.cellWith = cellWith; } } } 里面有一个方法叫download,此方法会以下载的方式读取excel,但是有一个缺点就是他会去先以流的形式读取excel,然后再以下载的方式去读取,这样效率会比较低,所以不是很推荐 * 第二种方法,以iframe的方式提交请求 * $scope.queryStationExport=function(type){ var exportframe = $('<iframe style="display:none"/>'); $scope.queryContent.agreementType=type; var url = encodeURI(encodeURI("signingRead/queryStationExport.do?resVo=" +JSON.stringify($scope.queryContent))); exportframe.attr({'src': url}); $('body').append(exportframe); }; 这里会把我们拼装的参数转换为stirng,在action的话,用string去接收,再转换成实体类; * @RequestMapping(value="queryLeagueExport") @ResponseBody public Object queryLeagueExport(@RequestParam String resVo,HttpServletRequest request, HttpServletResponse response) throws Exception{ String str = URLDecoder.decode(resVo); Vo Vo = JsonUtils.JsonStringToObject(str, Vo.class); return successReturnObject(signingReadManage.queryStationExport(request, response, Vo)); } 工具类 * /** * @param fileName 文件名 * @param is 文件流 * @param cl 类对象 * @return * @throws IOException 异常 */ public static <E> List<E> readExcelData(String fileName,InputStream is,Class<E> cl,ExcelRowDataCheck dataCheck,List<String> errorMsgList) throws Exception{ List<E> resultList=new ArrayList<E>(); Field[] fields = cl.getDeclaredFields(); //判断excel版本,并处理 if(isExcel2003(fileName)){ parseExcel2003Data(resultList, is, cl,fields,dataCheck,errorMsgList); }else if(isExcel2007(fileName)){ parseExcel2007Data(resultList, is, cl,fields,dataCheck,errorMsgList); } return resultList; } /** * @param resultList 结果集 * @param is 文件流 * @param cl 类对象 * @return * @throws IOException IO异常 */ private static <E> void parseExcel2003Data(List<E> resultList,InputStream is,Class<E> cl,Field[] fields,ExcelRowDataCheck dataCheck,List<String> errorMsgList) throws Exception{ POIFSFileSystem fs=new POIFSFileSystem(is); HSSFWorkbook wb=new HSSFWorkbook(fs); int sheetCount = wb.getNumberOfSheets(); for(int i=0;i<sheetCount;i++){ readSheetData(resultList, wb.getSheetAt(i), cl,fields,dataCheck,errorMsgList); } } /** * @param resultList 结果集 * @param is 文件流 * @param cl 类对象 * @return * @throws IOException IO异常 */ private static <E> void parseExcel2007Data(List<E> resultList,InputStream is,Class<E> cl,Field[] fields,ExcelRowDataCheck dataCheck,List<String> errorMsgList) throws Exception{ XSSFWorkbook xwb =new XSSFWorkbook(is); int sheetCount = xwb.getNumberOfSheets(); for(int i=0;i<sheetCount;i++){ readSheetData(resultList, xwb.getSheetAt(i), cl,fields,dataCheck,errorMsgList); } } /** * @param result 结果列表 * @param sheet sheet对象 * @param cl 类对象 * @throws IllegalAccessException * @throws Exception */ private static <E> void readSheetData(List<E> resultList,Sheet sheet,Class<E> cl,Field[] fields,ExcelRowDataCheck dataCheck,List<String> errorMsgList) throws Exception{ if(sheet!=null){ int rows=sheet.getPhysicalNumberOfRows(); if(rows>0){ Row row=null; Cell cell=null; for (int i = 1; i < rows; i++) { row=sheet.getRow(i); if(row!=null){//全部 E e = cl.newInstance(); for(int n=0;n<fields.length;n++){ Field f = fields[n]; cell = row.getCell(n); if(cell != null){ cell.setCellType(Cell.CELL_TYPE_STRING); f.setAccessible(true); f.set(e, cell.getStringCellValue()); } //setDataValue(f.getType(), cell.getCellType(), cell, f, e); } StringBuffer buffer = new StringBuffer("SheetName:"+sheet.getSheetName()+",RowNumber:"+row.getRowNum()); if(!dataCheck.checkRow(buffer, e,row.getRowNum())){ errorMsgList.add(buffer.toString()); }else{ resultList.add(e); } } } } } } /** * @param cell * 单元格 * @param value * 值 * @param cellType * 单元格类型 设置单元格的值 * @throws IllegalAccessException * @throws IllegalArgumentException */ private static <E> void setDataValue(Object fieldType,int cellType,Cell cell,Field f,E e) throws Exception { if (fieldType instanceof String) { cell.setCellType(Cell.CELL_TYPE_STRING); f.set(e, cell.getStringCellValue()); } else if (fieldType instanceof BigDecimal || fieldType instanceof Integer) { cell.setCellType(Cell.CELL_TYPE_NUMERIC); f.set(e, cell.getNumericCellValue()); } else if (fieldType instanceof Boolean) { cell.setCellType(Cell.CELL_TYPE_NUMERIC); f.set(e, cell.getBooleanCellValue()); } } public static boolean isExcel2003(String filePath){ return filePath.matches("^.+\\.(?i)(xls)$"); } public static boolean isExcel2007(String filePath){ return filePath.matches("^.+\\.(?i)(xlsx)$"); } /** * 功能描述:excel生成工具 */ public static <T> void toExcelOutStream(OutputStream out, String codedFileName, List<ExcelVo> header, List<T> datas) { try { String oldCodedFileName = codedFileName; // 产生工作簿对象 SXSSFWorkbook workbook = new SXSSFWorkbook(100); // 产生工作表对象 int sheetNum = 1; Sheet sheet = workbook .createSheet(codedFileName + "-" + sheetNum++); // 进行转码,使其支持中文文件名 codedFileName = java.net.URLEncoder .encode(codedFileName + DateUtils.getCurrentDateStrByFormat(DateUtils.TIMESTAMP_MSECS), "UTF-8"); generateExcelHeader(sheet, header, workbook); // 插入数据 Field field; int sheetLength = 0; int rowNum = 1; for (int i = 1; i <= datas.size(); i++) { T obj = datas.get(i - 1); if (obj != null) { // 加入超过单个Sheet的最大长度,则新城一个新的sheet页 sheetLength++; if (sheetLength >= 65535) { sheetLength = 0; rowNum = 1; sheet = workbook.createSheet(oldCodedFileName + "-" + sheetNum++); generateExcelHeader(sheet, header, workbook); } Row row = sheet.createRow(rowNum++);// 创建一行 for (int j = 0; j < header.size(); j++) { Cell cell = row.createCell(j);// 创建一列 cell.setCellType(header.get(j).getRowType()); field = obj.getClass().getDeclaredField( header.get(j).getRowNameEg()); field.setAccessible(true); Object value=new Object(); if(field.get(obj)!=null&&!"".equals(field.get(obj))){ if(field.getType().getSimpleName().equals("Date")){ value = field.get(obj); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd H:m:s"); value=format.format(value); }else{ value = field.get(obj); } setCellValue(cell, value, header.get(j).getRowType()); } } } } workbook.write(out); out.flush(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (out != null) { out.close(); } } catch (IOException e) { e.printStackTrace(); } } } public static void generateExcelHeader(Sheet sheet, List<ExcelVo> header, SXSSFWorkbook workbook) { // 单元格样式 CellStyle headerStyle = workbook.createCellStyle(); // 字体样式 Font font = workbook.createFont(); font.setFontHeightInPoints((short) 12); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); headerStyle.setFont(font); // 生成头行 if (header != null && header.size() > 0) { Row row = sheet.createRow(0);// 创建一行 for (int i = 0; i < header.size(); i++) { Cell cell = row.createCell(i);// 创建一列 cell.setCellType(header.get(i).getRowType()); cell.setCellValue(header.get(i).getRowNameCn()); cell.setCellStyle(headerStyle); sheet.setColumnWidth(i, header.get(i).getCellWith()); } } } /** * @param response * 响应流 * @param codedFileName * 文件名称,默认生成时间戳格式 * @param header * 头行数据 * @param datas * 表格数据 */ public static <T> void toExcelOutStream(HttpServletResponse response, String codedFileName, List<ExcelVo> header, List<T> datas) { // 生成提示信息, response.setContentType("application/vnd.ms-excel"); response.setHeader("content-disposition", "attachment;filename=" + codedFileName + ".xlsx"); try { toExcelOutStream(response.getOutputStream(), codedFileName, header, datas); } catch (IOException e) { e.printStackTrace(); } } /** * @param cell * 单元格 * @param value * 值 * @param cellType * 单元格类型 设置单元格的值 */ public static void setCellValue(Cell cell, Object value, int cellType) { if (cellType == HSSFCell.CELL_TYPE_STRING) { cell.setCellValue(String.valueOf(value)); } else if (cellType == HSSFCell.CELL_TYPE_NUMERIC) { cell.setCellValue((Double) value); } else if (cellType == HSSFCell.CELL_TYPE_BOOLEAN) { cell.setCellValue((Boolean) value); } else if (cellType == HSSFCell.CELL_TYPE_BLANK) { cell.setCellValue(""); } } /** * @Author * @Date 下午3:30:28 生成excel所需的头信息 */ public static class ExcelVo { public ExcelVo(String rowNameCn, int rowType, String rowNameEg) { this.rowNameCn = rowNameCn; this.rowNameEg = rowNameEg; this.rowType = rowType; } /** * 字段中文描述 */ private String rowNameCn; /** * 字段类型 * */ private int rowType; /** * 字段名 * */ private String rowNameEg; /** * 列宽 * */ private int cellWith = 25 * 256; public String getRowNameCn() { return rowNameCn; } public void setRowNameCn(String rowNameCn) { this.rowNameCn = rowNameCn; } public int getRowType() { return rowType; } public void setRowType(int rowType) { this.rowType = rowType; } public String getRowNameEg() { return rowNameEg; } public void setRowNameEg(String rowNameEg) { this.rowNameEg = rowNameEg; } public int getCellWith() { return cellWith; } public void setCellWith(int cellWith) { this.cellWith = cellWith; } } [https_poi.apache.org_apidocs_org_apache_poi_hssf_usermodel_HSSFWorkbook.html.]: https://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFWorkbook.html. [http_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFWorkbook.html.]: http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFWorkbook.html [https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFSheet.html.]: https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFSheet.html. [https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFRow.html]: https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFRow.html [https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFCell.html]: https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFCell.html [https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFCellStyle.html]: https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFCellStyle.html. [https_poi.apache.org_apidocs_org_apache_poi_hssf_util_HSSFColor.html.]: https://poi.apache.org/apidocs/org/apache/poi/hssf/util/HSSFColor.html. [https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFColor.html.]: https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFColor.html. [https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFFont.html.]: https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFFont.html. [https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFHyperlink.html]: https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFHyperlink.html [https_poi.apache.org_apidocs_org_apache_poi_xssf_usermodel_XSSFCreationHelper.html.]: https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFCreationHelper.html. [FontStyle]: /images/20220731/efd9c3ee0a92445680d86d3b9906f3b2.png [Hyperlink]: /images/20220731/9ab8095674e94d1880900afeeaeb4a1d.png
还没有评论,来说两句吧...