Win a copy of Head First Android this week in the Android forum!

gopal g gupta

Greenhorn
+ Follow
since Nov 06, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by gopal g gupta

Hi All,

I want to create a dynamic table in word doc using apache poi. So for examples - In my case there are 9 rows. In 1st row there is only 1 column. In 2nd, 4th and 5th rows there are 2 columns. In 3rd and 6th rows there are 3 columns. In 7th, 8th and 9th rows there are 7 columns. Also, how can i set the text in bold for specific cell.

Take a look at the attached snapshot for more clarification.

Please let me know the approach. Its urgent.
8 years ago
i want to extract image and text from a doc file. the code which i am trying works well.but now i want to extract image and text from docx file then this code throws an exception.
the code is-->



and the exception is-->


org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:111)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:151)
at org.apache.poi.hwpf.HWPFDocument.verifyAndBuildPOIFS(HWPFDocument.java:119)
at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:132)
at com.doylecentral.word.ReadDocFileFromJava.readMyDocument(ReadDocFileFromJava.java:33)
at com.doylecentral.word.ReadDocFileFromJava.main(ReadDocFileFromJava.java:24)

so please send me a sample code for docx file.since i am new to java so it is more difficult to make changes.
thanks in advance.
9 years ago
this is my code

9 years ago
i am unable to modify this code for docx file.so anyone can send me a sample code to extract image from docx file....
thanks in advance.
9 years ago
hello tim
its a docx file.i am new to java so please can you help me what modification should i made in my example.
thanks in advance.
9 years ago
hi
the file name is Hello.doc and its extension is docx.
9 years ago
i found the solution the file name should be Hello.doc.docx and i was using only Hello.doc

but i got another exception i.e.

org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. POI only supports OLE2 Office documents
at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:108)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:151)
at org.cloud.example.ReadDocFileFromJava.readMyDocument(ReadDocFileFromJava.java:31)
at org.cloud.example.ReadDocFileFromJava.main(ReadDocFileFromJava.java:24)

please help me.
9 years ago
hello everyone,
i made an application to retrieve image from a word document and to save it in a local directory but i am getting some exception.
the code is--->



and the exception i am getting when i run this code is---->


java.io.FileNotFoundException: D:\Hello.doc (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at org.cloud.example.ReadDocFileFromJava.readMyDocume nt(ReadDocFileFromJava.java:31)
at org.cloud.example.ReadDocFileFromJava.main(ReadDoc FileFromJava.java:24)


however the Hello.doc file exists in my D drive.so friends please help me what is the problem.
Thanks in advance.
9 years ago
thank you miku.....
10 years ago
thanks miku.the problem is solved by your reply on my another post.......
10 years ago
hi friends

i made a maven project in eclipse using spring when i deploy its war file on tomcat i am getting the following errors with my tomcat.

here is the log.

7 Nov, 2011 3:47:13 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [D:\apache-tomcat-6.0.33\lib\ext], exists: [false], isDirectory: [false], canRead: [false]
7 Nov, 2011 3:47:13 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.20.
7 Nov, 2011 3:47:13 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
7 Nov, 2011 3:47:14 PM org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
7 Nov, 2011 3:47:14 PM org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
7 Nov, 2011 3:47:14 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 738 ms
7 Nov, 2011 3:47:14 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
7 Nov, 2011 3:47:14 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.33
7 Nov, 2011 3:47:14 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
7 Nov, 2011 3:47:14 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
7 Nov, 2011 3:47:14 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive taskproject-0.0.1-SNAPSHOT.war
7 Nov, 2011 3:47:15 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
7 Nov, 2011 3:47:15 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/taskproject-0.0.1-SNAPSHOT] startup failed due to previous errors
7 Nov, 2011 3:47:15 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
7 Nov, 2011 3:47:15 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
7 Nov, 2011 3:47:15 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
7 Nov, 2011 3:47:15 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
7 Nov, 2011 3:47:15 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
7 Nov, 2011 3:47:15 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1807 ms

so please help me friends....what is wrong with it???
10 years ago
no its not a spring question......
it is related to maven project......
and when i run this maven project using apache tomcat it shows the above errors....
10 years ago
hi friends

i made a maven project using eclipse indigo, java1.6 and its dynamic web module is 3.0

now the problem is that when i run this maven project in eclipse using Tomcat v7.0 Server at localhost-config i got the following errors

Publishing failed with multiple errors
Resource is out of sync with the file system: '/taskproject/target/test-classes/com/FibonacciTest.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/com/Fibonacci.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/com/FibonacciController.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/com/IFibonacci.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/com/LocalSrvlt.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/com/RemoteSrvlt.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/com/Srvlt.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/com/Test1Fibonacci.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/com/TestFibonacci.class'.
Resource is out of sync with the file system: '/taskproject/target/classes/fibonacci.xml'.
File not found: D:\CEC\taskproject\target\classes\log4j.properties.
File not found: D:\CEC\taskproject\target\classes\log4j.xml.

so please anyone can help me what i have to do to make my maven project run in eclipse using Tomcat v7.0 Server at localhost-config
10 years ago
Hi freinds

I am new to spring & i made a project in eclipse using maven .

i am using spring & i put below code in my servlet

Resource resource = new FileSystemResource("beans.xml");
BeanFactory factory = new XmlBeanFactory(resource);
MyBean bean=(MyBean) factory.getBean("mybean");


and my beans.xml resides inside project/src folder
this code is working fine

now i want this initialization of beans.xml using springcontextloader
so i made these entries in web.xml file

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>beans.xmll</param-value>
</context-param>


now what changes should i made in myservlet to get factory & mybean as above
10 years ago