📄 htmldocwyjz.java
字号:
os.write("</table></center></div></body></html>");
os.flush();
os.close();
}
;
break;
default:
System.out.println("lienumber is not right");
}
// end switch
}// end try
catch (IOException io) {
// should put in status panel
System.err.println("IOException: " + io.getMessage());
}
}
// write the Doc.txt
public void WriteTxt() {
try {
/*
* FileDialog fileDialog; Frame frame =new Frame(); fileDialog = new
* FileDialog(frame); fileDialog.setMode(FileDialog.SAVE);
* fileDialog.show();
*
* String file1 = fileDialog.getFile(); if (file1 == null) return;
*
* String directory = fileDialog.getDirectory(); File file = new
* File(directory, file1+".txt");
*/
File file = new File("C:\\dfdydoc.txt");
FileWriter os = new FileWriter(file);
// write the columnname
for (int i = 0; i < tableView.getColumnCount(); i++)
os.write(tableView.getColumnName(i).toString() + "\t");
os.write("\n");
// write the table data
for (int i = 0; i < tableView.getRowCount(); i++) {
for (int j = 0; j < tableView.getColumnCount(); j++)
// os.write(tableView.getValueAt(i,j).toString()+"\t");
os.write(nullToTxt(tableView.getValueAt(i, j)) + "\t");
os.write("\n");
}
os.flush();
os.close();
// call the excel to process the dfdydoc.txt
// File excel=new File("excel.exe");
// System.out.println(excel.exists()); D:\\OFFICE97\\Office\\
// Runtime.getRuntime().exec("EXCEL.EXE "+file.getAbsolutePath());
file.deleteOnExit();
} catch (IOException io) {
// should put in status panel
System.err.println("IOException: " + io.getMessage());
}
}
// show the html
public void ShowHtml(JApplet applet) {
try {
File file = new File("C:\\Creat35.html");
URL newURL = file.toURL();
applet.getAppletContext().showDocument(newURL, "_blank");
} catch (MalformedURLException urlException) {
System.out.println("no such url");
}
}
public void WriteHtmlreportfh() {
try {
File file = new File("C:\\Creat35.html");
FileWriter os = new FileWriter(file);
os.write("<html><head><title>" + title + "</title></head><body>\n");
os.write("<table border=\"1\" cellspacing=\"0\">\n");
os.write("<tr align=\"right\">\n");
os
.write("<td colspan=27><b><font size=\"4\">"
+ title
+ " 编制人: 审核人: 批准人: </font></b></td>\n");
os.write("</tr>\n");
os.write("<tr>\n");
os.write("</tr>\n");
os.write("<tr align=\"center\">\n");
for (int i = 0; i < 27; i++) {
if (i == 0)
os.write("<td nowrap><b>"
+ tableView.getColumnName(i).toString()
+ "</b></td>\n");
else
os.write("<td nowrap><b>"
+ tableView.getColumnName(i).toString()
+ "</b></td>\n");
}
os.write("</tr>\n");
// write the table data
for (int i = 0; i < tableView.getRowCount(); i++) {
os.write("<tr align=\"center\">\n");
for (int j = 0; j < 27; j++) {
if (j == 0)
os.write("<td nowrap>"
+ nullToHtml(tableView.getValueAt(i, j))
+ "</td>\n");
else
os.write("<td nowrap>"
+ nullToHtml(tableView.getValueAt(i, j))
+ "</td>\n");
}
os.write("</tr>\n");
}
// os.write("<tr><td height=100 colspan=33></td></tr>");
os.write("</table>");
os.write("<br><br><br><br><br><br>");
os.write("<table border=\"1\" cellspacing=\"0\">\n");
os.write("<tr align=\"right\">\n");
os
.write("<td colspan=27><b><font size=\"4\">"
+ title
+ " 编制人: 审核人: 批准人: </font></b></td>\n");
os.write("</tr>\n");
os.write("<tr align=\"center\">\n");
os.write("<td nowrap><b>" + tableView.getColumnName(0).toString()
+ "</b></td>\n");
for (int i = 27; i <= 48; i++)
os.write("<td nowrap><b>" + String.valueOf(i) + "</b></td>\n");
os.write("<td nowrap colspan=4><b>"
+ tableView.getColumnName(50).toString() + "</b></td>\n");
// os.write ("<td colspan=10></td>");
os.write("</tr>\n");
for (int i = 0; i < tableView.getRowCount(); i++) {
os.write("<tr align=\"center\">\n");
os.write("<td nowrap>" + nullToHtml(tableView.getValueAt(i, 0))
+ "</td>\n");
for (int j = 27; j < tableView.getColumnCount(); j++) {
if (j < tableView.getColumnCount() - 2)
os.write("<td nowrap>"
+ nullToHtml(tableView.getValueAt(i, j))
+ "</td>\n");
else if (j == tableView.getColumnCount() - 1)
os.write("<td nowrap colspan=4>"
+ nullToHtml(tableView.getValueAt(i, j))
+ "</td>\n");
}
os.write("</tr>\n");
}
os.write("</table></body></html>");
os.flush();
os.close();
} catch (IOException io) {
// should put in status panel
System.err.println("IOException: " + io.getMessage());
}
}
public void WriteHtmlreportddl() {
try {
File file = new File("C:\\Creat35.html");
FileWriter os = new FileWriter(file);
os.write("<html><head><title>" + title + "</title></head><body>\n");
os.write("<table border=\"1\" cellspacing=\"0\" width=1400>\n");
os.write("<tr align=\"right\">\n");
os
.write("<td colspan=26><b><font size=\"4\">"
+ title
+ " 编制人: 审核人: 批准人: </font></b></td>\n");
os.write("</tr>\n");
os.write("<tr align=\"center\">\n");
for (int i = 0; i < 26; i++) {
if (i == 0)
os.write("<td width=190><b>"
+ tableView.getColumnName(i).toString()
+ "</b></td>\n");
else
os.write("<td width=52><b>"
+ tableView.getColumnName(i).toString()
+ "</b></td>\n");
}
os.write("</tr>\n");
// write the table data
for (int i = 0; i < tableView.getRowCount(); i++) {
os.write("<tr align=\"center\">\n");
for (int j = 0; j < 26; j++) {
if (j == 0)
os.write("<td width=190>"
+ nullToHtml(tableView.getValueAt(i, j))
+ "</td>\n");
else
os.write("<td width=52>"
+ nullToHtml(tableView.getValueAt(i, j))
+ "</td>\n");
}
os.write("</tr>\n");
}
os.write("<tr><td height=5 colspan=26 ></td></tr>");
// os.write("</table>");
// os.write("<p> </p>");
// os.write("<table border=\"1\" cellspacing=\"0\" width=1448>\n");
os.write("<tr align=\"center\">\n");
os.write("<td width=190><b>"
+ tableView.getColumnName(0).toString() + "</b></td>\n");
for (int i = 26; i <= 48; i++)
os
.write("<td width=52><b>" + String.valueOf(i)
+ "</b></td>\n");
os.write("<td colspan=2 width=52><b>"
+ tableView.getColumnName(49).toString() + "</b></td>\n");
// os.write ("<td colspan=10></td>");
os.write("</tr>\n");
for (int i = 0; i < tableView.getRowCount(); i++) {
os.write("<tr align=\"center\">\n");
os.write("<td width=190>"
+ nullToHtml(tableView.getValueAt(i, 0)) + "</td>\n");
for (int j = 26; j <= 48; j++) {
os.write("<td width=52>"
+ nullToHtml(tableView.getValueAt(i, j))
+ "</td>\n");
}
os.write("<td colspan=2 width=52>"
+ nullToHtml(tableView.getValueAt(i, 49)) + "</td>\n");
os.write("</tr>\n");
}
os.write("</table></body></html>");
os.flush();
os.close();
} catch (IOException io) {
// should put in status panel
System.err.println("IOException: " + io.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -