Results 1 to 12 of 12
Thread: Java and Writer
- 08-18-2011, 10:35 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
Java and Writer
I have open office installed my question is in the school have a permit for non-attendance is so
Justification of absence
Greenbow, .. August 2011
I ............... identified with the card No. ............................. Specific did not attend the following problems without further ......................................., to say to reiterate my respect for the institution, I say goodbye.
...............................................
student's name
I want to replace the points put my name and put the number on my card all you need to replace hope you can help me I am new to this but I learn fast java thanks in advance
- 08-18-2011, 11:33 PM #2
what is your question about i am not sure if you know what to ask but someone can help if you would ask a question about java programming this forum is to help java programmers so if this is a programming question please be specific
- 08-18-2011, 11:44 PM #3
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
I want to write in my odt in a specific area, i have 14 plz do not be rude to me, i select my name from java and put inside to my odt but there other text just do not want to change
I've been searching and found this
This overrides the words inside, but do not know how to say no to overwrite an important part of my documentJava Code:import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; public class ReadWriteTextFile { static public String getContents(File aFile) { StringBuilder contents = new StringBuilder(); try { BufferedReader input = new BufferedReader(new FileReader(aFile)); try { String line = null; while (( line = input.readLine()) != null){ contents.append(line); contents.append(System.getProperty("line.separator")); } } finally { input.close(); } } catch (IOException ex){ ex.printStackTrace(); } return contents.toString(); } static public void setContents(File aFile, String aContents) throws FileNotFoundException, IOException { if (aFile == null) { throw new IllegalArgumentException("File should not be null."); } if (!aFile.exists()) { throw new FileNotFoundException ("File does not exist: " + aFile); } if (!aFile.isFile()) { throw new IllegalArgumentException("Should not be a directory: " + aFile); } if (!aFile.canWrite()) { throw new IllegalArgumentException("File cannot be written: " + aFile); } Writer output = new BufferedWriter(new FileWriter(aFile)); try { output.write( aContents ); } finally { output.close(); } } /** Simple test harness. */ public static void main (String... aArguments) throws IOException { File testFile = new File("reaper.odt"); System.out.println("ORIGINAL TEXT: " + getContents(testFile)); setContents(testFile, "the data is overwrite..."); System.out.println("TEXT: " + getContents(testFile)); } }
I hope to be clear I just want to put my name in java and is writing in the name just that thanks T_T
- 08-18-2011, 11:54 PM #4
What is an "odt"?I want to write in my odt in a specific area
- 08-19-2011, 12:07 AM #5
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
is like .doc but from open office I do not really matter if it is recorded as a word or a writer because it opens open office can you help me?
- 08-19-2011, 12:11 AM #6
If you want to write a java program to read a .odt file, change its contents and write it back out, you need to know the format of the .odt file. To test how hard it will be to write a program to do this, open the file in Notepad, make the changes to it that you want to make and save it. If the Open Office program can now read the file and display the original contents with your changes then it you can probably write a java program to do what you did with Notepad.
- 08-19-2011, 12:15 AM #7
Let me get this straight. You have an Open Office document. You have Open Office which can modify an Open Office document. But instead of doing that you want to go the hard route of writing a Java program to modify the document. WHY? You already have a program that can do that. Is Open Office Word compatible? Then you might be able to use Apache POI to achieve your goals.
- 08-19-2011, 12:19 AM #8
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
java create any kind of file that's really funny. I write a text, doc but but I can not send a bold-type format in my title
- 08-19-2011, 12:27 AM #9
That is because Java is not a word processor. You are trying to use the wrong tool for the job.
- 08-19-2011, 12:30 AM #10
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
yes, but what happens is that I think in the future to write the whole school with a single button reading all the names of students and inserting them in the texts but I think only good is an illusion anyway thanks
- 08-19-2011, 12:35 AM #11
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0








- 08-19-2011, 10:27 AM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
Encoding in java.io.writer
By hariharabalan in forum New To JavaReplies: 1Last Post: 12-06-2010, 10:27 AM -
Researcher's Writer - My Personal Project
By GraceC1990 in forum Advanced JavaReplies: 2Last Post: 10-23-2010, 06:06 PM -
creating word writer
By Anchal in forum AWT / SwingReplies: 3Last Post: 04-06-2010, 09:00 AM -
CSV file writer
By nida in forum Java ServletReplies: 3Last Post: 05-08-2009, 02:08 PM -
[SOLVED] reader and writer on same file handle
By Nicholas Jordan in forum Advanced JavaReplies: 11Last Post: 07-01-2008, 03:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks