Powershell 导出Exchange 用户 EmailAddresses属性
2014-12-04 14:28
302 查看
/** * 设置单元格值 * @param wb * @param cell * @param sale */ public static void setBodyCellValue(HSSFWorkbook wb,HSSFCell cell,String sale){ CellStyle style = cell.getCellStyle(); Pattern p = Pattern.compile("^\\d+$"); Matcher matcher = p.matcher(sale); Pattern p2 = Pattern.compile("^[-]?\\d+[.]{1}\\d+[%]{1}$"); Matcher matcher2 = p2.matcher(sale); Pattern p3 = Pattern.compile("^\\d+[\\d|,]+$");//千分位 如355,656 Matcher matcher3 = p3.matcher(sale); if (matcher.matches()) {// 是数字当作double处理 cell.setCellValue(Double.parseDouble(sale)); style.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中 cell.setCellStyle(style); }else if (matcher2.matches()) {//百分比 sale = sale.replace("%", ""); Double d = Double.parseDouble(sale)/100; cell.setCellValue(d); //设置百分比格式 String formart = "0."; if(sale.contains(".")){ sale = sale.replace(".", "#"); String numArr[] = sale.split("#"); String ss = ""; if(numArr!=null&&numArr.length==2){ int length = numArr[1].length(); for (int i = 0; i < length; i++) { ss+="0"; } }else{ ss="0"; } formart+=ss; }else{ formart+="0"; } formart+="%"; style.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中 style.setDataFormat(wb.createDataFormat().getFormat(formart)); cell.setCellStyle(style); }else if(matcher3.matches()){ sale = sale.replace(",", ""); Integer salesNum = Integer.valueOf(sale); cell.setCellValue(salesNum); style.setDataFormat(wb.createDataFormat().getFormat("#,##0")); cell.setCellStyle(style); } else{//字符串 cell.setCellValue(sale+" "); } }
相关文章推荐
- Powershell导出活动目录用户信息表
- 导出AD用户属于哪个用户组的属性
- Exchange 2013 管理小技巧一-批量启用邮箱用户-利用Powershell
- Exchange2013配置-导出用户邮箱为PST文件
- SharePoint自动化部署,利用PowerShell 导出/导入AD中的用户
- 使用powershell命令,为exchange 2007用户配置邮箱数据
- .NET通过PowerShell操作ExChange为用户开通邮箱教程
- 【HOW】用PowerShell脚本修改用户配置文件属性显示次序
- SharePoint自动化部署,利用PowerShell 导出/导入AD中的用户
- PowerShell传递Exchange中的自定义属性(员工编号等)
- powershell 给用户添加自定义属性 Using PowerShell to Set a Custom Attribute
- Exchange 2010导出所有用户中最近3个月未发送邮件的账户
- .NET通过PowerShell操作ExChange为用户开通邮箱教程
- Powershell 修改AD用户属性
- 关于EXCHANGE的WHITE SPACE和从MAILDATABASE导出用户邮件到PST文件
- 导出带Exchange 邮箱的用户和没带邮箱的用户
- Exchange 导出用户数据
- Exchange 以OU为单位批量启用用户邮箱powershell 语句
- Exchange 2013 PowerShell导出报告至文本和CSV文件
- 利用Powershell快速导出域控所有用户Hash