You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Rajeshwar Mothe <ra...@gmail.com> on 2007/04/09 15:05:29 UTC
hi plsss help me out
when i tried this piece of code i am getting this error
import java.io.FileInputStream;
import org.apache.poi.hwpf.usermodel.*;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.*;
public class HWPF {
public static void main(String[] args) throws Exception{
HWPFDocument file;
file = new HWPFDocument(new FileInputStream("c:\\ResumeFormat.doc"));
String dd = file.getTextTable();
System.out.println(dd);
}
}
error is
C:\rajuwork>javac HWPF.java
HWPF.java:10: incompatible types
found : org.apache.poi.hwpf.model.TextPieceTable
required: java.lang.String
String dd = file.getTextTable();
^
1 error
Re: hi plsss help me out
Posted by Rajeshwar Mothe <ra...@gmail.com>.
hi sir
My requirement is to generate a resume in MSWORD format using HWPF (POI)
i retrieved values from Database and alredy displayed in JSP page called
as resume.jsp
now i want to display that data in a MSWORD using HWPF
i am new to HWPF
how i need to proceed and please send me sample code & where to start
plzzz help me out
plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
>
>
> }
>
>
Re: hi plsss help me out
Posted by za...@bracuniversity.ac.bd.
There was a mistake on my previous mail. This is OK:
import java.io.FileInputStream;
import org.apache.poi.hwpf.usermodel.*;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.*;
public class HWPF {
public static void main(String[] args) throws Exception{
HWPFDocument file;
file = new HWPFDocument(new FileInputStream("c:\\ResumeFormat.doc"));
Range range = file.getRange();
String dd = range.text());
System.out.println(dd);
}
}
Zahurul
www.zahurul.com
> You are to close. Check this:
>
> import java.io.FileInputStream;
> import org.apache.poi.hwpf.usermodel.*;
> import org.apache.poi.hwpf.HWPFDocument;
> import org.apache.poi.hwpf.*;
>
> public class HWPF {
> public static void main(String[] args) throws Exception{
> HWPFDocument file;
> file = new HWPFDocument(new FileInputStream("c:\\ResumeFormat.doc"));
> Range range = file.getRange();
> String dd = file.text());
> System.out.println(dd);
> }
> }
>
> Zahurul
> www.zahurul.com
>
>> when i tried this piece of code i am getting this error
>>
>> import java.io.FileInputStream;
>> import org.apache.poi.hwpf.usermodel.*;
>> import org.apache.poi.hwpf.HWPFDocument;
>> import org.apache.poi.hwpf.*;
>>
>> public class HWPF {
>> public static void main(String[] args) throws Exception{
>> HWPFDocument file;
>> file = new HWPFDocument(new FileInputStream("c:\\ResumeFormat.doc"));
>> String dd = file.getTextTable();
>> System.out.println(dd);
>> }
>> }
>>
>>
>> error is
>>
>> C:\rajuwork>javac HWPF.java
>> HWPF.java:10: incompatible types
>> found : org.apache.poi.hwpf.model.TextPieceTable
>> required: java.lang.String
>> String dd = file.getTextTable();
>> ^
>> 1 error
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: hi plsss help me out
Posted by Rajeshwar Mothe <ra...@gmail.com>.
hi all
when iam executing tthis code iam getting error plzzzzzz help me urgent
package com.vl.hr.resume.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.io.OutputStream;
import javax.servlet.ServletException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.log4j.Logger;
import com.vl.hr.util.common.CommonExceptionHandler;
import com.vl.hr.myprofile.values.EmployeePrimaryInformation ;
import com.vl.hr.myprofile.values.EmployeeGeneralInformation;
import com.vl.hr.myprofile.values.EmployeePersonalInformation;
import com.vl.hr.myprofile.values.EmployeeProfInformation;
import com.vl.hr.myprofile.values.EmployeeEducationInformation;
import com.vl.hr.myprofile.values.EmployeePreExperienceInformation;
import com.vl.hr.myprofile.values.EmployeeProfile;
import com.vl.hr.myprofile.values.EmployeeSkillsInformation;
import com.vl.hr.myprofile.values.EmployeeAwardsInformation;
import com.vl.hr.myprofile.values.EmployeeProjectHistory;
import org.apache.poi.hwpf.HWPFDocument;
public final class GenerateWordfile extends HWPFDocument {
private static Logger log = Logger.getLogger(GenerateWordfile.class);
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
HttpSession session=request.getSession(false);
try {
if(session!=null) {
PrintWriter out = response.getWriter();
/*
* to display the values in MS WORD format
*/
response.setContentType("application/msword");
/*
* creating an object for HWPF Document {
HWPF_doccument_obj }
*/
HWPFDocument HWPF_doccument_obj = new
HWPFDocument();
EmployeeProfile
emp_profile=(EmployeeProfile)session.getAttribute("data");
if(emp_profile.emp_primary_info!=null)
{
EmployeePrimaryInformation
epi=emp_profile.emp_primary_info;
String name=epi.firstname;
OutputStream output_stream_obj =
new DataOutputStream(name);
HWPF_doccument_obj.write(output_stream_obj);
//out.println(epi.firstname);
}
return mapping.findForward("success");
}
else {
log.warn("session failed");
return mapping.findForward("SessionFailure");
}
} catch(Exception e) {
return CommonExceptionHandler.getExceptionAction
("GenerateWordfile",mapping,request,e,null,"images/report_l.jpg");
}
}
}
error is :
C:\Tomcat files\hraccess\build\build.xml:45: Compile failed; see the
compiler er
ror output for details.
Total time: 3 seconds
C:\Tomcat files\hraccess\build>ant package
Buildfile: build.xml
init:
compile:
[delete] Deleting: C:\Tomcat
files\hraccess\src\properties\properties\Structu
re.xml
[copy] Copying 1 file to C:\Tomcat
files\hraccess\src\properties\properties
[javac] Compiling 7 source files to C:\Tomcat
files\hraccess\dist\classes
[javac] C:\Tomcat
files\hraccess\src\java\com\vl\hr\resume\action\GenerateWo
rdfile.java:71: cannot resolve symbol
[javac] symbol : constructor HWPFDocument ()
[javac] location: class org.apache.poi.hwpf.HWPFDocument
[javac] HWPFDocument HWPF_doccument_obj =
new
HWPFDocument();
[javac]
^
[javac] C:\Tomcat
files\hraccess\src\java\com\vl\hr\resume\action\GenerateWo
rdfile.java:89: cannot resolve symbol
[javac] symbol : class DataOutputStream
[javac] location: class com.vl.hr.resume.action.GenerateWordfile
[javac]
OutputStream output_stream_obj = new DataOutputStream(name);
[javac]
^
[javac] 2 errors
Re: hi plsss help me out
Posted by za...@bracuniversity.ac.bd.
You are to close. Check this:
import java.io.FileInputStream;
import org.apache.poi.hwpf.usermodel.*;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.*;
public class HWPF {
public static void main(String[] args) throws Exception{
HWPFDocument file;
file = new HWPFDocument(new FileInputStream("c:\\ResumeFormat.doc"));
Range range = file.getRange();
String dd = file.text());
System.out.println(dd);
}
}
Zahurul
www.zahurul.com
> when i tried this piece of code i am getting this error
>
> import java.io.FileInputStream;
> import org.apache.poi.hwpf.usermodel.*;
> import org.apache.poi.hwpf.HWPFDocument;
> import org.apache.poi.hwpf.*;
>
> public class HWPF {
> public static void main(String[] args) throws Exception{
> HWPFDocument file;
> file = new HWPFDocument(new FileInputStream("c:\\ResumeFormat.doc"));
> String dd = file.getTextTable();
> System.out.println(dd);
> }
> }
>
>
> error is
>
> C:\rajuwork>javac HWPF.java
> HWPF.java:10: incompatible types
> found : org.apache.poi.hwpf.model.TextPieceTable
> required: java.lang.String
> String dd = file.getTextTable();
> ^
> 1 error
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: hi plsss help me out
Posted by Rajeshwar Mothe <ra...@gmail.com>.
Hi tahir thank u very much once again for u r suggetion
but my requirement is i want to generate a MSword document from retrieving
values from Database
how i need to start
could u please send aome sample code so that i can start
please help me
RE: hi plsss help me out
Posted by Tahir Akhtar <ta...@spectrum-tech.com>.
The error basically says that the return type of
HWPFDocument.file.getTextTable() is not String but you are trying to assign
it to a String type variable. You must see the javadoc of TextPieceTable
class to understand what is being returned by the method.
> -----Original Message-----
> From: Rajeshwar Mothe [mailto:rajkishan.m@gmail.com]
> Sent: Monday, April 09, 2007 6:05 PM
> To: poi-user@jakarta.apache.org
> Subject: hi plsss help me out
>
> when i tried this piece of code i am getting this error
>
> import java.io.FileInputStream;
> import org.apache.poi.hwpf.usermodel.*;
> import org.apache.poi.hwpf.HWPFDocument;
> import org.apache.poi.hwpf.*;
>
> public class HWPF {
> public static void main(String[] args) throws Exception{
> HWPFDocument file;
> file = new HWPFDocument(new FileInputStream("c:\\ResumeFormat.doc"));
> String dd = file.getTextTable();
> System.out.println(dd);
> }
> }
>
>
> error is
>
> C:\rajuwork>javac HWPF.java
> HWPF.java:10: incompatible types
> found : org.apache.poi.hwpf.model.TextPieceTable
> required: java.lang.String
> String dd = file.getTextTable();
> ^
> 1 error
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/