Re: how to save a excel file using POI
Hi raghava just write it into an out put stream and use request.getOutputStream(); it will give an option to save then save it if it is not still clear then reply me with u r entire code snippet i will help u cheers RAJESHWAR VALUE LABS , INDIA
Re: how to save a excel file using POI
hey raghav is it the thing u did if not send me u r code snippet and thanks for sending intresting querys and where r u working now and how the culture in u r company import java.io.*; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.poifs.filesystem.POIFSFileSystem; public class POIFS { public POIFS(){ } public static void main(String[] args){ try { POIFSFileSystem fs = new POIFSFileSystem( new FileInputStream( C:\\raju.xls)); // create a workbook out of the input stream HSSFWorkbook wb = new HSSFWorkbook(fs); // get a reference to the worksheet HSSFSheet sheet = wb.getSheetAt(0); // create rows from 5 fill values in the 3rd column HSSFRow row1 = sheet.createRow((short) 4); // create a cell on the 3rd column HSSFCell c1_3 = row1.createCell((short) 3); FileOutputStream out = new FileOutputStream(C:\\result.xls); wb.write(out); } catch (Throwable t){ t.printStackTrace(); } } } by Cheers RAJESHWAR
Re: how to save a excel file using POI
hey raghav its intresting i think u did with overriding output stream i suppose. just send the code snippet just to watch and good work keep it up u rock it Cheers RAJESHWAR
Re: InvocationTargetException while reading an Excel file.
hi dude just go threw my code snippet i got same InvocationTargetException before while doing this i think it will help u just reply to this mail if u have any further conserns Cheers RajKishan ValueLabs ,INDIA
Re: InvocationTargetException while reading an Excel file.
Hi dude please check the value u r assigning for On 5/3/07, Rajeshwar Mothe [EMAIL PROTECTED] wrote: hi dude just go threw my code snippet String filePath i think the problem with that one i suppose by C u Have a nice day Cheers RajKishan i got same InvocationTargetException before while doing this i think it will help u just reply to this mail if u have any further conserns Cheers RajKishan ValueLabs ,INDIA
Re: InvocationTargetException while reading an Excel file.
Hi dude Now i am leaving the desk i'll reply u 2 maro just it is a problem with path of reading i suppose please forgive me sorry bose by c u Cheers Rajkishan On 5/3/07, Rajeshwar Mothe [EMAIL PROTECTED] wrote: Hi dude please check the value u r assigning for On 5/3/07, Rajeshwar Mothe [EMAIL PROTECTED] wrote: hi dude just go threw my code snippet String filePath i think the problem with that one i suppose by C u Have a nice day Cheers RajKishan i got same InvocationTargetException before while doing this i think it will help u just reply to this mail if u have any further conserns Cheers RajKishan ValueLabs ,INDIA
hi all regarding introducing new methods
Hi all i want to contribute to POI - HWPF Actually how i need to include my method in to API and what is the actual procedure what are all the conditions by jakarta.apache.org to include my methods in to their API i want the complete details please Cheers RAJ KISHAN
Re: Please help with ppt to txt code snippet...
Hi rupanu just specify the path according to ext3 Filesystem's Linux plat form i just tried it on windows but i will try it on linux machine actually what is the problem while executing on Linux machine if there r any querys just mail me i'll try to solve that ont and one more thing where r u working now by c u dude
Re: Problem with LArge Excel Sheet Generation
hi dear vinamra.singhai i got this error but i am able to generate large excel file using this Export.java file y cant u try it in ur code u r trying to generate new spread sheet i suppose plzz go thre this code good luck package com.vl.hr.reports.action; import java.util.ArrayList; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.hssf.usermodel.HSSFRichTextString; import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.log4j.Logger; import com.vl.hr.reports.values.Lists; class Export { private static Logger log = Logger.getLogger(Export.class); //creating a workbook; HSSFWorkbook wb = new HSSFWorkbook(); public HSSFWorkbook exportExcel(Lists lists, ArrayList list2, String title) { String[] outputs=lists.getOutputs(); String[] outputTypes=lists.getOutputTypes(); ArrayList al=list2; try{ //creating a worksheet HSSFSheet sheet=wb.createSheet(First sheet); HSSFCellStyle cs = wb.createCellStyle(); HSSFCellStyle cs2 = wb.createCellStyle(); HSSFCellStyle cs3 = wb.createCellStyle(); // create 2 fonts objects HSSFFont f = wb.createFont(); HSSFFont f2 = wb.createFont(); //set font 1 to 12 point type f.setFontHeightInPoints((short) 12); //make it red f.setColor((short) HSSFColor.RED.index); // make it bold //arial is the default font f.setBoldweight(f.BOLDWEIGHT_BOLD); //creation of the row for Titles HSSFRow row=sheet.createRow(0); //for loop, creating cell headings for(int i=0;ioutputs.length;i++) { HSSFCell cell=row.createCell((short)i); //set cell stlye cs.setFont(f); HSSFRichTextString str=new HSSFRichTextString(outputs[i]); cell.setCellValue(str); } int size = list2.size(); for(int i=0;isize;i++) { row=sheet.createRow(i+1); //creating a arraylist for internallists ArrayList al2=(ArrayList)list2.get(i); int al2size = al2.size(); for(int j=0;jal2size;j++) { HSSFCell cell=row.createCell((short)j); if(outputTypes[j].equals(String)){ cell.setCellValue((String)al2.get(j)); } else if(outputTypes[j].equals(double)){ cell.setCellValue(((Double)al2.get(j)).doubleValue()); } else if(outputTypes[j].equals(long)){ cell.setCellValue(((Long)al2.get(j)).longValue()); } else if(outputTypes[j].equals(Date)){ cell.setCellValue((String)al2.get(j)); } } } }catch(Exception e) { log.error(Error writing the Excel file); log.debug(e.getMessage()); } return wb; } }
Re: Please help with ppt to txt code snippet...
hi Rupanu Ranjaneswar this code is working dont fell tence ever we r POI users and its working perfectly if there are any querys mail me by c u have a nice day import java.io.*; import org.apache.poi.hslf.extractor.PowerPointExtractor; public class ppt{ public ppt(){ } public static void main(String[] args){ try{ FileInputStream in = new FileInputStream(C:\\raju.ppt); String str; PowerPointExtractor ppe = new PowerPointExtractor(in); str=ppe.getText(); FileWriter fw=new FileWriter(C:\\newppt.txt); fw.write(str); fw.close(); ppe.close(); } catch (Throwable t){ t.printStackTrace(); } } } On 4/18/07, Rupanu Ranjaneswar [EMAIL PROTECTED] wrote: Hello , I urgently and immediately need to convert some of my powerpoint files into txt files.I tried to use hslf but it's giving problems for slides with templates..Can anyone Please heilp with a code snippet do it..For your reference i am pasting my code here. --START CODE-- String str; PowerPointExtractor ppe = newPowerPointExtractor(filename); str=ppe.getText(); FileWriter fw=new FileWriter(F:\\newppt.txt); fw.write(str); fw.close(); ppe.close(); --END CODE-- __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Please help with ppt to txt code snippet...
java.lang.String *getTextfile:///C:/Documents%20and%20Settings/Induction/Desktop/rajeshwar/collection/docs/apidocs/org/apache/poi/hslf/extractor/PowerPointExtractor.html#getText%28boolean,%20boolean%29 *(boolean getSlideText, boolean getNoteText) hi , Rupanu Ranjaneswar u can use above method for ur perfect requirement thanks by c u have agood day
Re: Please help with ppt to txt code snippet...
Hi dear Rupanu Ranjaneswar u can use this piece of code also if required by dude have a nice day import java.io.*; import org.apache.poi.hslf.extractor.QuickButCruddyTextExtractor; public class ppt1{ public ppt1(){ } public static void main(String[] args){ try{ FileInputStream in = new FileInputStream(C:\\Log4J.ppt); String str; org.apache.poi.hslf.extractor.QuickButCruddyTextExtractor ppe = new org.apache.poi.hslf.extractor.QuickButCruddyTextExtractor(in); str=ppe.getTextAsString(); System.out.println(str); FileWriter fw=new FileWriter(C:\\log4jjkda.txt); fw.write(str); fw.close(); ppe.close(); } catch (Throwable t){ t.printStackTrace(); } } }
Re: Please help with ppt to txt code snippet...
Hi dudes POI users Mr.Rupanu Ranjaneswar try this code also its working fine yar by c u dudes have a good day import java.io.*; import java.util.*; import org.apache.poi.hslf.extractor.QuickButCruddyTextExtractor; public class ppt2{ public ppt2(){ } public static void main(String[] args){ try{ FileInputStream in = new FileInputStream(C:\\Log4J.ppt); String str = ; org.apache.poi.hslf.extractor.QuickButCruddyTextExtractor ppe = new org.apache.poi.hslf.extractor.QuickButCruddyTextExtractor(in); Vector v = new Vector(); FileWriter fw=new FileWriter(C:\\newppt.txt); v = ppe.getTextAsVector(); //Fetches the ALL the text of the powerpoint file, in a vector of strings, one per text record for ( Enumeration e = v.elements() ; e.hasMoreElements() ;) { System.out.println(e.nextElement()); str = str + e.nextElement() ; fw.write(str); } fw.close(); ppe.close(); } catch (Throwable t){ t.printStackTrace(); } } }
hi all plaese help me out
hi all i can create a table using this code but i want to insert data into cells plzz i am not getting help me int col=5; int rows=5; TableProperties tprops = new TableProperties(col); // tbProps. range = range.insertBefore(tprops , rows); thanks Rajeshwar Mothe
Re: Doc changes, Was: Re: please help me out
hi Rainer I want to display an image into word document using HWPF how i need to procced help me with some piece of code thanks regards Rajeshwar Mothe On 4/12/07, Rainer Schwarze [EMAIL PROTECTED] wrote: At 05:20 12.04.2007, Rainer Klute wrote: If this question is asked every now and then it is worth to be answered before the question is raised. This saved you and the user some effort - not to mention those users that won't ask but simply think that HWPF isn't useful and look for an alternative. And I wouldn't call the question What HWPF cannot do but rather How to create a new Word document. Hi, that were my thoughts after I got some sleep :-) Am I right in assuming that the quick guide on the POI web site is generated from the xdocs content in the project repository? (i.o.W: adding a topic is done by submitting a patch to the appropriate xml file?) Best wishes, Rainer Schwarze - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Doc changes, Was: Re: please help me out
hi patrick but i want to display a table i want to display data in it so plzz provide some code for that .. please by patrick waiting for u r reply urs Rajeshwar Mothe On 4/12/07, patrick roussel [EMAIL PROTECTED] wrote: Hi I have made a contribution about POI project, it concerns specially poi/hwpf. What I made is modify org/apache/poi/hwpf/usermodel/Range.java in order to make possible detection in tables that are contained in others tables (method getTable()), therefore I added two public methods : - getStartIdx - getEndIdx because the returned values can easily identify a paragrah by unicity in a range You'll also find an archive word2html.zip that contains jakarta-poi-full.jar (It's contains all poi project class including Range.class modified) and a small program that can convert an MS Word document to html. All files can found there : http://www.mirianet.com/poi/ Regards Patrick Roussel
Re: hi plsss help me out
hi all when iam executing tthis code iam getting error plzz 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\buildant 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
please help me out
hi Rainer Schwarze http://www.nabble.com/user/UserProfile.jtp?user=501276 turja , and hi alll i want to create a empty word document how i need to create please send me any code plzz help me by and waiting for u r reply
Re: hi plsss help me out
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
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 plzzz }