[英]Write String to Excel Sheet using jExcel API
I was going through this article by which I can start writing to Microsoft Excel sheet. 我正在阅读这篇文章 ,我可以开始写Microsoft Excel工作表。 But it shows only how to write an Integer. 但它只显示了如何编写整数。 In my case I need to write Strings to Excel Sheet
. 在我的情况下,我需要将Strings to Excel Sheet
写入Strings to Excel Sheet
。 In that strings I have IP Address
as well. 在那个字符串中我也有IP Address
。
So below is the scenario in which it is failing because ipAddress is String with dots in between the number. 因此下面是失败的情况,因为ipAddress是字符串,数字之间有点。 And also I cannot convert that String to Integer because of dots in between the number so that is the reason I was looking for other alternative. 而且我也无法将该字符串转换为整数,因为数字之间有点,所以这就是我寻找其他替代方案的原因。
So is there any other alternative to Number class below which I can use for String? 那么我可以在下面使用String类的其他任何替代方法吗?
addNumber(sheet, 0, j, ipAddress);
private void addNumber(WritableSheet sheet, int column, int row, Integer integer) throws WriteException,
RowsExceededException {
Number number;
number = new Number(column, row, integer, times);
sheet.addCell(number);
}
you can try by using new Label() as follow 您可以尝试使用新的Label(),如下所示
sheet.addCell(new Label(column, row, String)) sheet.addCell(new Label(column,row,String))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.