lotus中Excel的导出
来源:互联网 发布:淘宝网防晒服 编辑:程序博客网 时间:2024/06/05 23:55
import java.io.PrintWriter;
import lotus.domino.AgentBase;
import lotus.domino.AgentContext;
import lotus.domino.Database;
import lotus.domino.DocumentCollection;
import lotus.domino.NotesException;
import lotus.domino.Session;
import lotus.domino.Document;
import java.util.Vector;
/**
* 将视图数据导出到excel中
*
*/
public class OutputToExcel extends AgentBase {
private Session session = null;
private AgentContext agentContext = null;
private Database db = null;
private PrintWriter pw = null;
private StringBuilder sb = null;
private static String[] FIELDS = { "Year", "Month", "BM", "GZYHM",
"JBGZ", "XYGZ", "NGGZ", "BT", "GZHJ", "BK", "KK", "YFHJ", "SBTC", "ZFGJJ", "GHF", "DKS",
"ZK", "BF", "DBHJ", "SFHJ"};
private static String[] FIELDSNAME = { "年份", "月份", "部门", "用户名",
"基本工资", "效益工资", "年功工资", "补贴" , "合计", "补款", "扣款", "应发合计", "社保统筹",
"住房公积金", "工会费", "代扣税", "暂扣", "补发", "合计", "实发合计"};
public void NotesMain() {
try {
session = getSession();
agentContext = session.getAgentContext();
db = agentContext.getCurrentDatabase();
pw = getAgentOutput();
sb = new StringBuilder();
pw.println("Content-Type:application/vnd.ms-excel");
printHead();
printView();
pw.print(sb.toString());
} catch (Exception e) {
e.printStackTrace();
} finally {
recycle();
}
}
private void printHead() {
for (String fieldName : FIELDSNAME) {
sb.append(fieldName);
sb.append("\t");
}
sb.append("\n");
}
private void printView() throws NotesException {
Document docNow = agentContext.getDocumentContext();//当前文档
//搜索需要导出的工资
String year = docNow.getItemValueString("Year");
String month = docNow.getItemValueString("Month");
String username = docNow.getItemValueString("YHM");
String bm = docNow.getItemValueString("BM");
//释放空间
docNow.recycle();
//搜索条件
String sql = "Form='yggz' & @Contains(GZVerifyStatus;'已确认')";
if(!year.equals("")){
sql = sql + "& @Contains(Year;'" + year + "')";
}
if(!month.equals("")){
sql = sql + "& @Contains(Month;'" + month + "')";
}
if(!username.equals("")){
sql = sql + "& @Contains(GZYHM;'" + username + "')";
}
if(!bm.equals("")){
sql = sql + " & @Contains(BM;'" + bm + "')";
}
DocumentCollection docs = db.search(sql);
int num = docs.getCount();
//如果没有输入搜索条件,则搜索结果为空
if(year.equals("") && month.equals("") && username.equals("") && bm.equals("")){
num = 0;
}
Document doc = docs.getFirstDocument();
Document temp = null;
while (num != 0 && doc != null) {
printDocInfo(doc);
temp = docs.getNextDocument(doc);
doc.recycle();
doc = temp;
}
}
private void printDocInfo(Document doc) throws NotesException {
for (String field : FIELDS) {
Vector fldvalue = doc.getItemValue(field);
String fld = "";
if (fldvalue.size() > 0) {
fld = fldvalue.get(0).toString();
}
sb.append(fld);
sb.append("\t");
}
sb.append("\n");
}
private void recycle() {
try {
if (pw != null) {
pw.close();
}
if (db != null) {
db.recycle();
}
if (agentContext != null) {
agentContext.recycle();
}
if (session != null) {
session.recycle();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
- lotus中Excel的导出
- lotus客户端导出Excel
- lotus notes库中数据导出到excel中
- lotus domino EXCEL导出功能开发
- Lotus Notes 数据库中附件的批量导出
- 将lotus表单中的域全部导出到excel表中
- java中excel的导出
- Lotus中千奇百怪的 $$
- lotus中操作excel--引入excel数据至notes中
- 从GRIDVIEW中导出EXCEL的方法
- winForm中C#实现Excel的导出
- asp中导出Excel的方法
- asp.net中Excel的导入导出
- 简单的excel报表导出(jsp中)
- Updatepanel 中导出excel的解决办法
- Dataset导出excel的不同sheet中
- C#中导出Excel报表的方法
- 导出HTML的Table到Excel中
- 测试开发工程师的发展
- javaweb
- openfire connectionmanager源码分析
- 数理逻辑:命题逻辑(2)命题逻辑公式
- 客户区和非客户区指的什么?窗口客户区和视图客户区的区别
- lotus中Excel的导出
- 正则表达式_百科
- 修正dedecms无法生成联动类别数据的js文件
- httpClient发送post请求
- 数理逻辑:命题逻辑(3)永真公式与可满足公式
- 设计响应式导航菜单的五大法则
- Android3.1后Boot_COMPLETED广播收不到的问题及解决办法
- 提高C#编程水平的50个要点
- 数理逻辑:命题逻辑(4)等效关系