How to replace a line ina text file using java?
Hi ALL,
Does anybody know how to replace a line in a text file uisng java.
use this thing:
http://doesthatevencompile.com/current-projects/code-sniplets/ASCIIFile.htm
open the file,
read its contents, replace the text you need in the contents, set the contents back into the file.
it takes care of the IO for you.
Similar Messages
-
How to read a text file using Java
Guys,
Good day!
Please help me how to read a text file using Java and create/convert that text file into XML.
Thanks and God Bless.
Regards,
I-Talkpublic void fileRead(){
File aFile =new File("myFile.txt");
BufferedReader input = null;
try {
input = new BufferedReader( new FileReader(aFile) );
String line = null;
while (( line = input.readLine()) != null){
catch (FileNotFoundException ex) {
ex.printStackTrace();
catch (IOException ex){
ex.printStackTrace();
}This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
cheers
Mohammed Jubaer Arif. -
Read lines from text file to java prog
how can I read lines from input file to java prog ?
I need to read from input text file, line after line
10x !If you search in THIS forum with e.g. read lines from file, you will find answers like this one:
Hi ! This is the answer for your query. This program prints as the output itself reading line by line.......
import java.io.*;
public class readfromfile
public static void main(String a[])
if you search in THIS forum, with e.g. read lines from text file
try{
BufferedReader br = new BufferedReader(new FileReader(new File("readfromfile.java")));
while(br.readLine() != null)
System.out.println(" line read :"+br.readLine());
}catch(Exception e)
e.printStackTrace();
} -
How to print a text file using Java
How can I print a text file using Java without converting the output to an image format. Is there anyway I can send the characters in the text file as it is for a print job? I did get a listing doing this ... but that converted the text to an image format before printing....
THanks,.Hi I had to write a print api from scratch, and I did not convert the output to image. Go and read up on the following code. I know there is a Tutorial on Sun about the differant sections of the snippet.
private void printReport()
Frame tempFrame = new Frame(getName());
PrintJob printerJob = Toolkit.getDefaultToolkit().getPrintJob(tempFrame, "Liesltext", null);
Graphics g = printerJob.getGraphics();
//I wrote the method below for calculations
printBasics(g);
g.dispose();
printerJob.end();
}This alone wont print it you have to do all the calculations in the printBasics method. And as I said I wrote this from scratch and all I did was research first the tutorial and the white papers
Ciao -
How to convert a HTML files into a text file using Java
Hi guys...!
I was wondering if there is a way to convert a HTML file into a text file using java programing language. Likewise I would also like to know if there is a way to convert any type of file (excel, power point, and word) into text using java.
By the way, I really appreciated the help that you guys gave me on my previous topic on how to extract tests from a pdf file.
Thank you....HTML files are already text files. What do you mean you want to convert them?
I think if you search the web, you can find things for converting those MS Office files to text (or extracting text from them, as I assume you mean). -
Read Text file using Java Script
Hi,
I am trying to read a text file using Java Script within the webroot of MII as .HTML file. I have provided the path as below but where I am not able to open the file. Any clue to provide the relative path or any changes required on the below path ?
var FileOpener = new ActiveXObject("Scripting.FileSystemObject");
var FilePointer = FileOpener.OpenTextFile("E:\\usr\\sap\\MID\\J00\\j2ee\\cluster\\apps\\sap.com\\xapps~xmii~ear\\servlet_jsp\\XMII\\root\\CM\\OCTAL\\TestTV\\Test.txt", 1, true);
FileContents = FilePointer.ReadAll(); // we can use FilePointer.ReadAll() to read all the lines
The Error Log shows as :
Path not found
Regards,
MohamedHi Mohamed,
I tried above code after importing JQuery Library through script Tag. It worked for me . Pls check.
Note : You can place Jquery1.xx.xx.js file in the same folder where you saved this IRPT/HTML file.
<HTML>
<HEAD>
<TITLE>Your Title Here</TITLE>
<SCRIPT type="text/javascript" src="jquery-1.9.1.js"></SCRIPT>
<script language="javascript">
function Read()
$.get( "http://ldcimfb.wdf.sap.corp:50100/XMII/CM/Regression_15.0/CrossTab.txt", function( data ) {
$(".result").html(data);
alert(data);
// The file content is available in this variable "data"
</script>
</HEAD>
<BODY onLoad="Read()">
</BODY>
</HTML> -
How to create a table in the file using java code.?
HI,
I should export the data from the view objects to a word document. I have done that but I should
display the data in the form of a table.
Kindly come up with the necessary information on how to create a table in the file using java.
Thanks,
PhaniHi, Thank you for responding to my query.
The below are the details of my code.
DCBindingContainer dcBindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding StudentDetailsContent =
(DCIteratorBinding)dcBindings.get("StudentView1Iterator");
OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
Row currentRow =
StudentDetailsContent.getRowSetIterator().first();
Object a[]= currentRow.getAttributeValues();
int i;
for(i=0 ;i<=a.length;i++){
w.write(a.toString());
w.write(" ");
w.flush();
I am usning this coding to achieve the task of exporting data to file.
I need to display this information in the table that is where I need help from you people.
Thanks, -
Changing HTML to text file using java
Hi,
I am doing a project in which i have to read news articles from websites. I have tried XML but for that i need to know which tag has the article in it. Since i have to read from various websites so each site used different tags for different informations.
Is there anyway that i can change an HTML file into a text file using java. Maybe some command that removes all the HTML tags and gives just the information. Is there anything else that anyone would like to recommend?
Thanx
yafisMaybe something like this:
import java.io.*;
import java.net.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
class GetHTMLText
public static void main(String[] args)
throws Exception
EditorKit kit = new HTMLEditorKit();
Document doc = kit.createDefaultDocument();
// The Document class does not yet handle charset's properly.
doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
// Create a reader on the HTML content.
Reader rd = getReader(args[0]);
// Parse the HTML.
kit.read(rd, doc, 0);
// The HTML text is now stored in the document
System.out.println( doc.getText(0, doc.getLength()) );
// Returns a reader on the HTML data. If 'uri' begins
// with "http:", it's treated as a URL; otherwise,
// it's assumed to be a local filename.
static Reader getReader(String uri)
throws IOException
// Retrieve from Internet.
if (uri.startsWith("http:"))
URLConnection conn = new URL(uri).openConnection();
return new InputStreamReader(conn.getInputStream());
// Retrieve from file.
else
return new FileReader(uri);
} -
How to read some lines from a text file using java.
hi,
i m new to java and i want to read some lines from a text file based on some string occurrence in the file. This file to be read in steps.
we only want to read the file upto the first Occurrence of "TEXT" string.
How to do it ,,,
Kinldy give the code
Regards,
Sagar
this is the text file
dfgjdjj
sfjhjkd
ghjkdg
hjkdgh TEXT
ikeyt
ujt
jk
tyk TEXT
rukl
rHendawy wrote:
Since the word "TEXT" is formed of 4 letters, you would read the text file 4 bytes by four bytes. Wrong on two counts. First, the file may not be encoded 1 byte per character. It could be utf-16 in which case it would be two byte per character. Second, even if it were 1 byte per character, the string "Text" may not start on a 4 byte boundary.
Consider a FileInputStream object "fis" that points to your text file. use fis.read(byte[] array, int offset, int len) to read every four bytes. Convert the "TEXT" String into a byte array "TEXT".getBytes(), and yous the Arrays class to compare the equality of the read bytes with your "TEXT".getBytes()Wrong since it relies on my second point and will fail when fis.read(byte[] array, int offset, int len) does not read 4 bytes (as is no guaranteed to). Check the Javadoc. Also, the file may not be encoded with the default character encoding.
The problem is easily solved by reading a line at a time using a BufferedReader wrapping an InputStreamReader wrapping a FileInputStream and specifying the correct character encoding.
Edited by: sabre150 on Apr 29, 2009 2:13 PM -
How to write empty line in text file
hey
i want to insert one empty line in text file.
how to write this.
i declared
data: emptyrec(240) type c value space,
and used
TRANSFER emptyrec to e_file.
but its not inserting empty line in the record.
is there any special way have to do.
ambichan.hai anand,
I am posting the code snippet.
i have commented that transfer line in '----
' like this
pls refer below.
ambichan
DATA: PAGENO(4) TYPE N VALUE 1,
DATAKBN(2) TYPE N VALUE 1,
SUBNO(3) TYPE N VALUE 1,
VPAGENO(4) TYPE C,
VDATAKBN(2) TYPE C,
VSUBNO(3) TYPE C,
VREC(255) TYPE C,
VRECORD(255) TYPE C,
EMPTYREC(255) TYPE C VALUE SPACE,
VCODE(10) TYPE C,
VNAME2(35) TYPE C,
VPAYDAT(10) TYPE C,
VSGTXT(60) TYPE C VALUE SPACE,
VSGTXT1(10) TYPE C,
VKINGAKU(15) TYPE C VALUE SPACE,
VBIKKO(30) TYPE C VALUE SPACE,
VBELNR(10) TYPE C VALUE SPACE,
VDMBTR(15) TYPE C,
VGLT0-KSLVT(15) TYPE C,
VGLT0-TSL01(15) TYPE C,
VGLT0-TSL02(15) TYPE C,
VGLT0-TSL03(15) TYPE C,
VGLT0-TSL04(15) TYPE C,
VGLT0-TSL05(15) TYPE C,
VKIN(15) TYPE C,
VTEGA(15) TYPE C.
FORM FRM_OUTPUT_DATA.
SORT ITAB_OUTPUT_SUMMARY BY LIFNR DTYPE.
SORT ITAB_OUTPUT_ITEMS BY LIFNR DTYPE BELNR.
IF P_DISP = 'X'."checkボクスを選ぶ場合、ファイル作成処理へ行く
OPEN DATASET E_FILE FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC <> 0.
WRITE: 'error',SY-SUBRC.
EXIT.
ENDIF.
LOOP AT ITAB_LIFNR.
PERFORM LISTDATA.
PAGENO = PAGENO + 1.
SUBNO = 1.
ENDLOOP.
CLOSE DATASET E_FILE."ファイルクローズ
ENDFORM. " End of frm_output_data
FORM LISTDATA.
DATA:
WK_PAY_AMOUNT LIKE BSEG-DMBTR, " 純支払額算出用
VWK_PAY_AMOUNT(15) TYPE C,
GLT0-TSL05_VAL LIKE GLT0-TSL05.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 1.
BSIK-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
GLT0-TSL01 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 2. " 区分:2
GLT0-TSL02 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 3. " 区分:3
GLT0-TSL03 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 4. " 区分:4
GLT0-TSL04 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 5. " 区分:5
GLT0-TSL05 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
glt0-tsl05 = glt0-tsl05 + glt0-tsl04.
WK_PAY_AMOUNT = GLT0-TSL05 + GLT0-TSL04.
CHECK WK_SUBRC = 0.
BSEG-KOART = ' '. 情報不要
CLEAR: BSEG-SGTXT, BSEG-DMBTR, TGSBT-GTEXT, BKPF-BELNR.
BSEG-KOART = 'Y'. " フラグ:ヘッダに相殺額を出力
CLEAR: BSAK-DMBTR.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 6. " 区分:6
BSAK-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - BSAK-DMBTR.
WRITE : / PAGENO,
SUBNO,
DATAKBN,
ITAB_LIFNR-LIFNR,
ITAB_LIFNR-NAME2(25),
P_PAY_T,
GLT0-TSL01,
GLT0-TSL02,
GLT0-TSL03,
GLT0-TSL04,
GLT0-TSL05.
VPAGENO = PAGENO.
VSUBNO = SUBNO.
DATAKBN = 1.
VDATAKBN = DATAKBN.
VCODE = ITAB_LIFNR-LIFNR.
VNAME2 = ITAB_LIFNR-NAME2.
VPAYDAT = P_PAY_T.
VGLT0-TSL01 = GLT0-TSL01.
VGLT0-TSL02 = GLT0-TSL02.
VGLT0-TSL03 = GLT0-TSL03.
VGLT0-TSL04 = GLT0-TSL04.
VGLT0-TSL05 = GLT0-TSL05.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT VKINGAKU
VBIKKO VBELNR VGLT0-TSL01 VGLT0-TSL02 VGLT0-TSL03
VGLT0-TSL04 VGLT0-TSL05 INTO VREC SEPARATED BY ','.
CLEAR: BSAK-DMBTR, BSID-DMBTR, BSAD-DMBTR, BSEG-DMBTR, BSIK-DMBTR,
WK_10 , WK_11 , GLT0-TSL05.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 7. " 区分:7
BSID-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - BSID-DMBTR.
郵送料の出力処理
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 8. " 区分:8
BSAD-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - BSAD-DMBTR.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 9. " 区分:9
BSEG-DMBTR = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - BSEG-DMBTR.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 10.
WK_10 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
READ TABLE ITAB_OUTPUT_SUMMARY
WITH KEY LIFNR = ITAB_LIFNR-LIFNR DTYPE = 11.
WK_11 = ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
GLT0-TSL05 = WK_PAY_AMOUNT - WK_10 - WK_11.
WK_PAY_AMOUNT = WK_PAY_AMOUNT - GLT0-TSL05.
VWK_PAY_AMOUNT = WK_PAY_AMOUNT.
VKIN = WK_10.
VTEGA = WK_11.
CONCATENATE VREC VWK_PAY_AMOUNT VKIN VTEGA INTO
VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :
VWK_PAY_AMOUNT,
WK_10,
WK_11.
WRITE:/.
BSEG-KOART = 'X'. " フラグ:請求金額を出力
LOOP AT ITAB_OUTPUT_ITEMS WHERE LIFNR = ITAB_LIFNR-LIFNR
AND DTYPE = 5. " 区分:5
BSEG-SGTXT = ITAB_OUTPUT_ITEMS-SGTXT. " 明細テキスト
GLT0-KSLVT = ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO. " 金額
TGSBT-GTEXT = ITAB_OUTPUT_ITEMS-GTEXT. BKPF-BELNR = ITAB_OUTPUT_ITEMS-BELNR.
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
DATAKBN = 2.
VDATAKBN = DATAKBN.
VGLT0-KSLVT = GLT0-KSLVT.
VBIKKO = TGSBT-GTEXT.
VBELNR = BKPF-BELNR.
VSGTXT1 ='請求金額:'.
CLEAR VRECORD.
CONCATENATE VSGTXT1 BSEG-SGTXT INTO VSGTXT.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VGLT0-KSLVT VBIKKO VBELNR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :/ VPAGENO,VSUBNO,VDATAKBN,'請求金額:', VSGTXT, VGLT0-KSLVT,
VBIKKO,VBELNR.
ENDLOOP.
CLEAR: BSEG-SGTXT,GLT0-KSLVT,BKPF-BELNR.
LOOP AT ITAB_OUTPUT_ITEMS WHERE LIFNR = ITAB_LIFNR-LIFNR
AND DTYPE = 6. " 区分:6
BSEG-SGTXT = ITAB_OUTPUT_ITEMS-SGTXT. " 明細テキスト
IF ITAB_OUTPUT_ITEMS-SHKZG = CNS_CREDIT. " 金額
GLT0-KSLVT = ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO.
ELSEIF ITAB_OUTPUT_ITEMS-SHKZG = CNS_DEBIT.
GLT0-KSLVT = ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO * -1.
ENDIF.
TGSBT-GTEXT = ITAB_OUTPUT_ITEMS-GTEXT. " 事業領域テキスト
BKPF-BELNR = ITAB_OUTPUT_ITEMS-BELNR. " 伝票番号
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
DATAKBN = 3.
VDATAKBN = DATAKBN.
VGLT0-KSLVT = GLT0-KSLVT.
VBIKKO = TGSBT-GTEXT.
VBELNR = BKPF-BELNR.
VSGTXT1 ='相殺金額:'.
CLEAR VRECORD.
CONCATENATE VSGTXT1 BSEG-SGTXT INTO VSGTXT.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VGLT0-KSLVT VBIKKO VBELNR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
concatenate vpageno vsubno vdatakbn
WRITE :/ PAGENO,SUBNO,DATAKBN,'相殺金額',BSEG-SGTXT, GLT0-KSLVT,
TGSBT-GTEXT, BKPF-BELNR.
ENDLOOP.
CLEAR VRECORD.
*Insert empty line.
TRANSFER EMPTYREC TO E_FILE.
DATAKBN = 3.
VDATAKBN = DATAKBN.
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
VSGTXT ='源泉金額'.
VDMBTR = BSID-DMBTR.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VDMBTR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :/ PAGENO, SUBNO,DATAKBN, ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
P_PAY_T,'源泉金額', BSID-DMBTR.
CLEAR: VDMBTR, VSGTXT, VRECORD.
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
VSGTXT = '郵送料'.
VDMBTR = BSAD-DMBTR.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VDMBTR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :/ PAGENO, SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
P_PAY_T,'郵送料', BSAD-DMBTR.
CLEAR: VDMBTR, VSGTXT, VRECORD.
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
VSGTXT = '振込み手数料'.
VDMBTR = BSEG-DMBTR.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VDMBTR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
CLEAR: VDMBTR, VSGTXT, VRECORD.
WRITE :/ PAGENO,SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
P_PAY_T,'振込み手数料',BSEG-DMBTR.
*その他の支払いの処理
SUBNO = SUBNO + 1.
VSUBNO = SUBNO.
VSGTXT = 'その他の支払い'.
VDMBTR = GLT0-TSL05.
CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
VDMBTR INTO VRECORD SEPARATED BY ','.
TRANSFER VRECORD TO E_FILE.
WRITE :/ PAGENO,SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
P_PAY_T, 'その他の支払い',GLT0-TSL05.
glt0-tsl05.
ULINE.
CLEAR: VREC, VRECORD,VCODE,VNAME2,VPAYDAT,VSGTXT,VSGTXT1,VKINGAKU.
CLEAR: VBIKKO,VBELNR,VDMBTR,VGLT0-KSLVT,VGLT0-TSL01,VGLT0-TSL02.
CLEAR: VGLT0-TSL03,VGLT0-TSL04,VGLT0-TSL05,VKIN,VTEGA,VWK_PAY_AMOUNT.
ENDFORM. -
How to replace a character in a file using awk
Hello,
Does anyone has a sample script to replace a character in a file using awk?
Regards,
Edited by: slsam01 on Jul 15, 2012 12:56 PMHi
awk it's not best for this job.
For replace charecter - generaly use tr or sed
Example on awk:
awk -F<old_char> ' { for (i=1; i<NF ;i++ ) printf ( "%s<new_char>", $i ); print $NF }' <file>
#Replace "e" on "a" in /etc/hosts
awk -Fe ' { for (i=1; i<NF ;i++ ) printf ( "%sa", $i ); print $NF }' /etc/hosts
Regards.
PS. Same on *tr"
cat file | tr "e" "a" -
How to Write in bold to a file using java I/O classes?
Hi,
Using I/O classes I want to prepare a .doc file in which some text will be there. I want that text to be formatted. Like some text I want to be bold. Some text to be italic. How can I write bold/Italic text to the file using java I/O classes.
Thanks
PrashantBy .doc file, I'm assuming you mean an MS Word document, yes? (fyi, Word Perfect also used the .doc extension)
The .doc format is proprietary to Microsoft and isn't documented by them. In order to output a file in .doc format you'd have to understand that format correctly, otherwise MS Word will spit out it's tongue at you, call you names, and maybe send the Microsoft Police to "audit" your PC Software Licensing.
Fortunately for you there is an open source project to demangle the microsoft file formats. See http://jakarta.apache.org/poi/ and especially pay attention to the HDF project (Horrible Document Format).
- David -
Displaying of a text file using JAVA in a browser.
Please can you give me the code for displaying of a text file using a bean and java coding. Please include all files needed. Thanks
please could you give us 200 Uss each for the work done for you plz include all needed recipes plz? thx
-
How to store grid points in a file using Java Swing?
Please someone help me with any suggestions about how to store the grid points in a file using Java Swing
Actually i have designed a gridlayout in Java Swing and have added some components to it such as buttons or images....My problem is when I click on any of the cell of the grid,the corresponding cell number should be stored in an external file....Do u have any suggestions on how to do it?
-
How to create and edit a .ini file using java
Hi All...
Pls help me in creating and editing an .ini file using java...
thanks in advance
Regards,
sathyaLet's assume the ini file is a mapping type storage (key=value) so lets use Properties object. (works with java 1.4 & up)
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
public class Test {
private static Properties props;
public static void main(String[] args) throws IOException {
File file = new File("test.ini");//This is out ini file
props = new Properties();//Create the properties object
read(file);//Read the ini file
//Once we've populated the Properties object. set/add a property using the setProperty() method.
props.setProperty("testing", "value");
write(file);//Write to ini file
public static void read(File file) throws IOException {
FileInputStream fis = new FileInputStream(file);//Create a FileInputStream
props.load(fis);//load the ini to the Properties file
fis.close();//close
public static void write(File file) throws IOException {
FileOutputStream fos = new FileOutputStream(file);//Create a FileOutputStream
props.store(fos, "");//write the Properties object values to our ini file
fos.close();//close
}
Maybe you are looking for
-
Hi I want to round off my order qty based on ROH. Say ROH is available multiples of 0.6 TONS.My Fert is need to plan so to that it consumes 0.6 ,1.2 , 1.8 etc TONS. Without using Material-Qty calculatiuon is it possible?? Because I am using Discrete
-
I have the CS 5 Suite instaled on 2 of my Macs (per Adobe licensing). I upgraded (aftwrward, in 2012) just the Photoshop CS 5 app to Photoshop CS 6. There is a GREAT filter [then new] with PS CS 6 called "Oil Paint". I hope to be able to find out fr
-
Unable to launch swf in standalone player
I'm unable to launch swf's with the standalone player from within flexbuilder, it will always use the browser. I've unchecked the option 'Generate HTML wrapper file' from the 'Actionscript Compliler' settings menu and I've tried to force it to use th
-
Hi, Can any one please help with the following questions ? What is Java Annotation and its applicability ? How does its absence & presence makes difference ?? Thanks in advance.
-
Can I see what software a serial number is for ?
I get an error when entering the serial number and I thought maybe I have chosen the wrong software to install (CS Design Standard, maybe I should try download other variants) ? I do not know what software package the license is for so can you tell b