Hi
In my project i want to convert the input file to the .doc format. I convert the text file into the .doc file by using the below code
import java.io.*;
public class test1 {
public static void main(String[] args) throws IOException {
FileInputStream fin;
int i;
BufferedReader is = new BufferedReader( new FileReader("C:/tes.txt"));
try
{
try
{
fin=new FileInputStream ("C:/tes.txt");
} catch(FileNotFo undException e) {
System.out.prin tln("Input file not found");
return;
}
} catch(ArrayInde xOutOfBoundsExc eption e) {
System.out.prin tln("Usage:Copy file From TO");
return;
}
System.out.prin tln("File Read");
BufferedOutputS tream bytesOut = new BufferedOutputS tream(new FileOutputStrea m("C:/myFile1.doc"));
// Copy File
try
{
do
{
i=fin.read();
System.out.prin tln(i);
if(i != -1)
bytesOut.write( i);
}while(i!= -1);
} catch(IOExcepti on e) {
System.out.prin tln("File error");
}
System.out.prin tln("File Created");
// Code here to read from is, write to bytesOut
bytesOut.close( );
}
}
In the same method i also convert the .xls file but in the output the content will be displayed like this
· Ú 1 È ÿ A r i a l 1 È ÿ A r i a l 1 È ÿ A r i a l 1 È ÿ A r i a l "$"#,##0_);\("$ "#,##0\) ! "$"#,##0_);[Red]\("$"#,##0\) " "$"#,##0.00_);\ ("$"#,##0.00 \) ' " "$"#,##0.00 _);[Red]\("$"#,##0.00\) 7 * 2 _("$"* #,##0_);_("$"* \(#,##0\);_("$" * "-"_);_(@_) . ) ) _(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_) ? , : _("$"* #,##0.00_);_("$ "* \(#,##0.00\);_( "$"* "-"??_);_(@_) 6 + 1 _(* #,##0.00_);_(* \(#,##0.00\);_( * "-"??_);_(@_) à õÿ À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ
what can i do to see the original message. The powerpoint files also open in the same condition. Please give the solution to solve the problem.
Thanks in advance,
Geethu
In my project i want to convert the input file to the .doc format. I convert the text file into the .doc file by using the below code
import java.io.*;
public class test1 {
public static void main(String[] args) throws IOException {
FileInputStream fin;
int i;
BufferedReader is = new BufferedReader( new FileReader("C:/tes.txt"));
try
{
try
{
fin=new FileInputStream ("C:/tes.txt");
} catch(FileNotFo undException e) {
System.out.prin tln("Input file not found");
return;
}
} catch(ArrayInde xOutOfBoundsExc eption e) {
System.out.prin tln("Usage:Copy file From TO");
return;
}
System.out.prin tln("File Read");
BufferedOutputS tream bytesOut = new BufferedOutputS tream(new FileOutputStrea m("C:/myFile1.doc"));
// Copy File
try
{
do
{
i=fin.read();
System.out.prin tln(i);
if(i != -1)
bytesOut.write( i);
}while(i!= -1);
} catch(IOExcepti on e) {
System.out.prin tln("File error");
}
System.out.prin tln("File Created");
// Code here to read from is, write to bytesOut
bytesOut.close( );
}
}
In the same method i also convert the .xls file but in the output the content will be displayed like this
· Ú 1 È ÿ A r i a l 1 È ÿ A r i a l 1 È ÿ A r i a l 1 È ÿ A r i a l "$"#,##0_);\("$ "#,##0\) ! "$"#,##0_);[Red]\("$"#,##0\) " "$"#,##0.00_);\ ("$"#,##0.00 \) ' " "$"#,##0.00 _);[Red]\("$"#,##0.00\) 7 * 2 _("$"* #,##0_);_("$"* \(#,##0\);_("$" * "-"_);_(@_) . ) ) _(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_) ? , : _("$"* #,##0.00_);_("$ "* \(#,##0.00\);_( "$"* "-"??_);_(@_) 6 + 1 _(* #,##0.00_);_(* \(#,##0.00\);_( * "-"??_);_(@_) à õÿ À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ
what can i do to see the original message. The powerpoint files also open in the same condition. Please give the solution to solve the problem.
Thanks in advance,
Geethu
Comment