Current location - Quotes Website - Signature design - It is best to have a detailed introduction and source code to explain how to write word files directly with java.
It is best to have a detailed introduction and source code to explain how to write word files directly with java.
Import java.io.fileoutputstream;

Import java.io.ioexception;

Import java.io.printstream;

//Create three non-empty. Doc (of course, it can also be. txt,。 Java…) files are placed in the current path (default).

Public class FileTest

{

//Throw the exception to the Java virtual machine for processing.

The public static void main(String[] args) throws IOException.

{

//I & gt; -1, always true, create an infinite file and it becomes a virus.

for(int I = 0; I<3; i++)

{

//Specify the file name to enter.

String name = "a" + i +"。 doc ";

//define a node output stream FilOutputStream.

//popular point: define a water pipe and lead out the name file.

file output stream out = new file output stream(name);

//Wrap the node stream with PrintStream and output the string with PrintStream.

//Popular point: add a PrintStream to the water supply pipe, which has the function of discharging water (ps.print ()).

PrintStream PS = new PrintStream(out);

Ps.print ("Me, Me, Me, Wo Wo, Wo Wo, Wo Wo, Oh, Me");

Ps.append ("you");

}

}

}

Everything is in the code!