Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

copy workbook(xls) using xls

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if workbook1 contains pattern in some cell then in the copy workBook that pattern is getting copied
but pattern color is not getting copied.

Please see the code below.

File file = new File("C:\\New Microsoft Excel Worksheet.xls");
File file2 = new File("C:\\test1.xls");
Workbook workbook1 = Workbook.getWorkbook(file);
WritableWorkbook copy = Workbook.createWorkbook(file2, workbook1);

Please help me.

 
Sheriff
Posts: 21817
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which library are you using? I don't recognize class Workbook, and I think there are not a lot of people who do.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Prime wrote:Which library are you using? I don't recognize class Workbook, and I think there are not a lot of people who do.


Apache POI HSSF: http://poi.apache.org/apidocs/org/apache/poi/hssf/model/Workbook.html

Which is one of the most commonly used Java API´s for Excel though.
 
Rob Spoor
Sheriff
Posts: 21817
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always used the usermodel subpackage, not the model. That one includes HSSFWorkbook, so that's why I didn't recognize it.

I think the Other Open Source Software forum will get some more reponse.
 
Rahul Dhaware
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using jxl lib files.
 
That new kid is a freak. Show him this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!