使用java jxl在excel中创建和访问工作表(Creating and accessing sheets in excel using java jxl)
我正在使用jxl创建一个excel文件。 我想用日期命名 - 22-03-2012(第1张),23-03-2012(第2张),等等。 这里我正在创建文件和第一张表(这只运行一次):
File file = new File(inputFile); WorkbookSettings wbSettings = new WorkbookSettings(); wbSettings.setLocale(new Locale("en", "EN")); Date now = Calendar.getInstance().getTime(); DateFormat df = new SimpleDateFormat("MM-dd-yyyy"); String theDate = df.format(now); System.out.println(theDate); WritableWorkbook workbook = Workbook.createWorkbook(file, wbSettings); workbook.createSheet(theDate, 0); // now access it and do some operations WritableSheet excelSheet = workbook.getSheet(theDate); prepareSheet(excelSheet); workbook.write(); workbook.close();
现在,当我访问该文件并稍后修改它时(另一个类 - 每次想要添加更多数据时运行),我需要检查“它仍然是今天”。 换句话说,如果最后一张表的名称是22-03-2012而今天是22-03-2012 - >访问并修改此表,并且如果最后一张表的名称与当前日期不同 - >创建一个新表。 我想这是一个简单的“如果”声明的问题,但由于某种原因我不能使它工作。 需要新鲜的眼睛:)谢谢
I'm creating an excel file using jxl. I'd like to name the sheets with dates - 22-03-2012(1st sheet), 23-03-2012(2nd sheet), and so on. Here I'm creating the file and the first sheet (this runs only once):
File file = new File(inputFile); WorkbookSettings wbSettings = new WorkbookSettings(); wbSettings.setLocale(new Locale("en", "EN")); Date now = Calendar.getInstance().getTime(); DateFormat df = new SimpleDateFormat("MM-dd-yyyy"); String theDate = df.format(now); System.out.println(theDate); WritableWorkbook workbook = Workbook.createWorkbook(file, wbSettings); workbook.createSheet(theDate, 0); // now access it and do some operations WritableSheet excelSheet = workbook.getSheet(theDate); prepareSheet(excelSheet); workbook.write(); workbook.close();
Now, when I access the file and modify it later on (another class - runs everytime you want to add more data), I need to check whether "it's still today". In other words, if the name of the last sheet is 22-03-2012 and today is 22-03-2012 -> access and modify this sheet, and if the name of the last sheet is different from current date -> create a new sheet. I guess this is a matter of simple "if" statement, but for some reason I can't make it work. Need fresh eyes :) Thanks
原文:https://stackoverflow.com/questions/9823587
最满意答案
如果你正在谈论在你的bg img上覆盖颜色,那么rgba需要与img在同一个css块中
body { background-image: bgimg.jpg; background-color: rgba(0,0,0,0.4); font-family: 'Source Sans Pro', sans-serif; font-weight: 300; letter-spacing: -0.01em; overflow-x: hidden; position: relative; }
If you're talking about overlaying color on your bg img then the rgba needs to be in the same css block as the img
body { background-image: bgimg.jpg; background-color: rgba(0,0,0,0.4); font-family: 'Source Sans Pro', sans-serif; font-weight: 300; letter-spacing: -0.01em; overflow-x: hidden; position: relative; }
相关问答
更多-
您可以尝试抓取cssText和className 。 var css1 = table.rows[1].style.cssText; var css2 = table.rows[2].style.cssText; var class1 = table.rows[1].className; var class2 = table.rows[2].className; // sort // loop if (i%2==0) { table.rows[i].style.cssText = ...
-
var app = angular.module('App', []); app.controller('Ctrl', ['$scope', function($scope){ $scope.gradient = "linear-gradient(to bottom, rgba(255, 0, 0, 0.45), rgba(255, 0, 0, 1))"; }]); .box { width: 300px; height: 300px; background: grey; } ...
-
声明一个“HTML”页的“HEAD”元素外CSS样式?(Declare CSS style outside the “HEAD” element of an “HTML” page?)[2023-06-13]
HTML5允许您将style元素范围属于style的父节点和子节点。 (查看scoped属性)。 我不知道现在还有多好的支持。 至少是HTML5规范的一部分,在未来几年内可能会得到更好的支持。 一个如何使用它的例子:lorem ipsum dolor sit amet ...
RGBa边框颜色和元素(RGBa border color & element)[2021-12-31]
问题似乎是input元素是替换元素(因为它由底层操作系统提供/呈现,而不是浏览器本身;虽然我不知道操作系统无法正确处理rgba()颜色)。 它不是一个理想的解决方案,但将input元素包装在另一个元素中,并对包装元素的边框进行样式处理:相关文章
更多- java jxl 操作excel 时老是这个错误
- java+jsp来获取excel的数据?
- jxl解析excel并导入数据库
- JXLS根据excel模板生成EXCEL并下载
- POI 操作 Excel的主要API
- jar 包 的用处 ,dozer、poi、itext 、jxl 、jbarcode 、itextrenderer jquery 效果
- 使用POI操作Excel和Word
- lucene读取word,excel,pdf
- POI 操作Excel公式
- POI Excel电子表格处理
最新问答
更多- h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
- 创建一个功能(Create a function)
- 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
- PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
- Qt冻结循环的原因?(Qt freezing cause of the loop?)
- TableView重复youtube-api结果(TableView Repeating youtube-api result)
- 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
- SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
- 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
- 以编程方式创建UITableView(Creating a UITableView Programmatically)
- 如何打破按钮上的生命周期循环(How to break do-while loop on button)
- C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
- 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
- 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
- Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
- 设置kotlin扩展名(Setting a kotlin extension)
- 如何并排放置两个元件?(How to position two elements side by side?)
- 如何在vim中启用python3?(How to enable python3 in vim?)
- 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
- 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
- Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
- dedecms如何安装?
- 在哪儿学计算机最好?
- 学php哪个的书 最好,本人菜鸟
- 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
- 如何覆盖错误堆栈getter(How to override Error stack getter)
- 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
- USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
- 电脑高中毕业学习去哪里培训
- 正则表达式验证SMTP响应(Regex to validate SMTP Responses)