小米6将小米手机导出通话记录录导出为excel文件

红米手机 &
电视盒子 &
智能硬件 &
神仙级手机控
楼主的荣誉
扫码下载App一键签到 升级加速
求助:请问怎么将EXCEL里的电话号码导入小米6。谢谢!
扫一扫!手机看帖更爽
如题:求助:请问怎么将EXCEL里的电话号码导入小米6。谢谢!
扫描二维码,手机查看本帖
另存为*.csv格式
楼主,你好,用Excel编辑好联系人内容,名称一列,电话号码一列。然后另存为*.csv格式(去掉所有不兼容格式时选“是”),然后用记事本打开这个文件,看看是不是联系人和电话号码中间用逗号隔开的,是的话保存即可。具体方法可以看看这个帖子https://jingyan.baidu.com/article/af5518ffbc9c3.html
京ICP证110507号 京ICP备号一、综述:
目前页面生成excel的方法很多,总结起来,不外乎两类,一种是使用excel对象,一种是“伪文件”。两种方法
是各自有各自的优缺点,在不同的领域也都有很多成功的案例。前者使用对象的方式很灵活,可以生成任意表现
方式的excel文件,缺点也很明显,比如在asp下,使用excel如果发生异常,excel对象的资源是不会释放的,也
就是说在特殊情况下会把服务器“拖死”。后者的方式一般使用的是html文件,但是后缀是xls,也就是“伪文件
”,这样的操作在生成excel文件的时候,对比第一种方法系统开销比较小,但是由于是“伪文件”,在打开文件
的时候会有提示,但是由于生成html的方法很多,也是目前在我们系统中采用比较多的方式,另外他生成复杂样
式的时候也比较方便,可以采用tr td的方式加上style.
二、方案说明
下面我要说的这种方式,是目前能找到的最快的生成excel文件的方式,姑且叫做“bcp生成csv”方法吧。它有
以下几个适用的范围。需要说明我的这篇文章不是要生成完美的excel文件,是要解决大数据量下快速生成excel文件的问题,我发现很多园子的朋友都误解了,特此说明
1.生成的excel格式比较单一,没有合并列等情况
2.生成的文件格式为csv,但是可以用excel默认打开
3.执行的存储过程用户需要xp_cmdshell权限
接下来,说说它的好处:
1.生成效率很高,由于是并发操作,每1000条数据传送一次
2.生成的文件没有冗余代码,全部为数据信息,保证了文件是所有类型中最小的
3.没有office2003中的excel的单sheet的6万多行的限制,就算输出10万条数据也能正常生成,但是用excel2003
打开失败,用excel2007打开正常
但是由于使用上的不方便,我就写了一个存储过程,只需要传递几个参数进去,就能自动生成对应的excel文件
。先贴上代码:
&&1USE&[student]
&&3/**//******&对象:&&StoredProcedure&[dbo].[proc_2csv]&&&&脚本日期:&12/30/:17&******/
&&4SET&ANSI_NULLS&ON
&&6SET&QUOTED_IDENTIFIER&ON
&&8/**//**************************************************************
&&9/*************&copyright&by&James.wang(天生我豺)***************
&10/*************&欢迎转载,转载请注明原作者**********************
&11/*************&email:&**************************/
&13create&PROCEDURE&[dbo].[proc_2csv]
&15&&&&--参数声明
&16&&&&@sql1&varchar(<span style="color: #00)='',--from之前的SQL语句
&17&&&&@sql2&varchar(<span style="color: #00)='',--from之后的SQL语句
&18&&&&@columneName&varchar(<span style="color: #00)=''--显示的列名,用英文,分割
&24&&&&Set&NOCOUNT&ON
&25&&&&Declare&@ErrNum&int,
&26&&&&&&&&&&&&@tablename&varchar(<span style="color: #0),
&27&&&&&&&&&&&&@ErrInfo&varchar(<span style="color: #0),
&29&&&&&&&&&&&&@outfilename&varchar(<span style="color: #0),
&30&&&&&&&&&&&&@tmpsql&varchar(<span style="color: #00),
&31&&&&&&&&&&&&@cursql&varchar(<span style="color: #00),
&32&&&&&&&&&&&&@csv&varchar(<span style="color: #00)
&33&&&&set&@tablename='student.dbo.[tmp_'+Convert(varchar(<span style="color: #),newID())+']'
&36&&&&&&&&&&set&@tmpsql=@sql1+'&into&'+&@tablename&+&'&'+@sql2
&37&&&&&&&&&&
&38&&&&&&&&&&exec&(@tmpsql)
&39&&&&&&&&&&--print&@tmpsql
&40&&&&&&&&&&if&@@ERROR&&<span style="color: #
&41&&&&&&&&&&&&&begin
&42&&&&&&&&&&&&&&&&select&@ErrNum=<span style="color: #001,@ErrInfo='生成物理表错误'
&43&&&&&&&&&&&&&&&&goto&On_Error
&44&&&&&&&&&&&&&end
&46&&&&set&@tmpsql=''
&47&&&&set&@cursql=''
&48&&&&set&@outfilename=right(@tablename,len(@tablename)-<span style="color: #)
&50&&&&/**//*column替换*/
&51&&&&set&@columneName=replace(@columneName,',',''''',''''')
&52&&&&set&@columneName=''''''+@columneName+''''''
&54&&&&/**//*组合输出字符*/
&55&&&&Declare&@curColName&varchar(<span style="color: #)
&56&&&&Declare&currentcur&cursor&for&
&57&&&&select&t2.name&from&sysobjects&t1,syscolumns&t2&where&t1.id=t2.id&and&t1.xtype='U'&and&
&59t1.id=object_id(@outfilename)
&60&&&&Open&currentcur
&61&&&&FETCH&NEXT&From&currentcur&into&@curColName
&63&&&&WHILE&@@FETCH_STATUS&=&<span style="color: #
&64&&&&&&&&BEGIN
&65&&&&&&&&&&&&set&@cursql=@cursql+'''''&&&&''''+'+@curColName+','
&66&&&&&&&&&&&&FETCH&NEXT&From&currentcur&into&@curColName
&67&&&&&&&&END
&68&&&&CLOSE&currentcur
&69&&&&DEALLOCATE&currentcur
&70&&&&set&@cursql=left(@cursql,len(@cursql)-<span style="color: #)
&71&&&&set&@tmpsql='select&'+@columneName+'&union&all&select&'+@cursql+'&from&'+@tablename
&72&&&&--print&@tmpsql
&74&&&&/**//*导出数据到csv*/
&75&&&&set&@csv='master..xp_cmdshell&''bcp&"'+&@tmpsql&+'"&&queryout&&
&77d:\edufeweb\dufenew\'+@outfilename+'.csv&&-c&&&-t","&&&-r"\n"&-S"<span style="color: #2.16.4.*"&&&-U"sa"&&&-
&79P"password"&''&'
&81&&&&--print&@csv
&82&&&&exec(@csv)
&84&&&&/**//*删除临时表*/
&85&&&&if&exists(select&<span style="color: #&from&&[dbo].[sysobjects]&where&&id&=&object_id(@tablename)&and&&type&=&'U')
&86&&&&&&&&begin
&87&&&&&&&&&set&@tmpsql='drop&table&'+@tablename
&88&&&&&&&&&&exec(@tmpsql)
&89&&&&&&&&&&if&@@ERROR&&<span style="color: #
&90&&&&&&&&&&&&&&&begin
&91&&&&&&&&&&&&&&&&select&@ErrNum=<span style="color: #002,@ErrInfo='删除物理表错误'
&92&&&&&&&&&&&&&&&&goto&On_Error
&93&&&&&&&&&&&&&end
&94&&&&&&&end&&&&&
&96&&&&Set&NOCOUNT&OFF
&97&&&&&&&&select&@outfilename
&98&&&&Set&NOCOUNT&ON
&99&&&&return
<span style="color: #0
<span style="color: #1On_Error:
<span style="color: #2&&&if&exists(select&<span style="color: #&from&&[dbo].[sysobjects]&where&&id&=&object_id(@tablename)&and&&type&=&'U')
<span style="color: #3&&&&&&&begin
<span style="color: #4&&&&&&&&&set&@tmpsql='drop&table&'+@tablename
<span style="color: #5&&&&&&&&&exec(@tmpsql)
<span style="color: #6&&&&&&&end
<span style="color: #7&&&&raiserror&@ErrNum&@ErrInfo
<span style="color: #8&&&&Return
<span style="color: #9END
四、代码说明
&& 1.@sql1:传入sql语句中的from的前面的语句
&& 2.@sql2:传入sql语句中的from的后面的语句,包括from
&& 3.@columneName:传入显示的列标题,用英文的逗号分割
&& 4.例子:
[proc_2csv] 'select top 1000 userid,cardname,cardid,studentname,case sex when ''1'' then ''男''
else ''女'' end sex','from registersys','用户名,证件类型,证件号码,姓名,性别'
五、补充说明:
&& 1.如果传入的sql语句中有单引号,在传入之前替换成两个单引号
&& 2.如果传入的sql语句有英文的逗号,替换成全角的逗号
&& 3.注意master..xp_cmdshell代码中的172.16.4.*替换成你机器ip,后面替换成对应的帐户和密码,注意这个
帐户必须有xp_cmdshell的权限
六、引申:
& 很多人会说用sa不安全,用xp_cmdshell不安全,确实是这样,但是我们可以采用临时授予当前用户执行系统
扩展存储过程权限,这个方面我也正在学习,如果大家有这方面的想法可以一起探讨。
& 以下是我找到的一些资源:
&& 1.如何在不提升用户权限的情况下,使普通用户执行xp_cmdshell存储过程
&& http://blog.csdn.net/puddingpudding/archive//3445833.aspx
&& 2.重新设置代理和 SQLAgentCmdExec 帐户
&& http://support.microsoft.com/kb/264155/zh-cn
阅读(...) 评论()借助POI的excel接口,可以方便得实现excel导出功能:
首先需要引入poi对应的jar包
1.前端jsp页面需要一个a链接。
web页面文件MIM类型的下载,只需要一个a元素,该a可以链到该文件在服务器端的实体路径,也可以链接到一个servelt,将该文件写到response的输出流中。其他的下载浏览器会自动帮助完成。
&a type="button" class="btn btn-warning" href='/WebTest/ExportExcel' id='export'&导出&/a&
2,该链接对应的后台处理servlet代码实现
package com.bobo.
import java.io.FileNotFoundE
import java.io.FileOutputS
import java.io.IOE
import java.io.OutputS
import java.io.PrintW
import java.io.UnsupportedEncodingE
import java.net.URLE
import java.util.ArrayL
import java.util.HashM
import javax.servlet.ServletE
import javax.servlet.http.HttpS
import javax.servlet.http.HttpServletR
import javax.servlet.http.HttpServletR
import org.apache.poi.hssf.usermodel.HSSFS
import org.apache.poi.hssf.usermodel.HSSFW
import com.bobo.helper.ExcelH
import com.bobo.modal.ShitiM
import com.bobo.modal.XixiangM
public class ExportExcel extends HttpServlet {
* The doGet method of the servlet. &br&
* This method is called when a form has its tag value method equals to get.
* @param request
the request send by the client to the server
* @param response
the response send by the server to the client
* @throws ServletException
if an error occurred
* @throws IOException
if an error occurred
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
process(request, response);
* The doPost method of the servlet. &br&
* This method is called when a form has its tag value method equals to
* @param request
the request send by the client to the server
* @param response
the response send by the server to the client
* @throws ServletException
if an error occurred
* @throws IOException
if an error occurred
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
process(request, response);
@SuppressWarnings("deprecation")
private void process(HttpServletRequest request,
HttpServletResponse response) throws UnsupportedEncodingException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.reset();
response.setContentType("application/x-msexcel");
String fileName = URLEncoder.encode("巡查实体列表", "utf-8");
response.addHeader("Content-Disposition", " filename="
+ new String(fileName.getBytes("utf-8"), "ISO8859-1") + ".xls");
HSSFWorkbook wb = new HSSFWorkbook();
// 表头数足
String[] title = { "实体编号", "实体名称", "省", "市", "巡查人", "巡查结果", "巡查时间",
"细项名称", "巡查人", "巡查结果", "巡查时间", "不合格原因" };
ArrayList&ShitiModal& content = new ArrayList&ShitiModal&();
for (int i = 0; i & 6; i++) {
ShitiModal shiti = new ShitiModal();
shiti.setShitiCity("杭州");
shiti.setShitiName("二龙路基站");
shiti.setShitiNum("");
shiti.setShitiPerson("张三");
shiti.setShitiProvince("浙江");
shiti.setShitiResult("不合格");
shiti.setShitiTime("日");
// 填充细分项
ArrayList&XixiangModal& xixiangList = new ArrayList&XixiangModal&();
for (int j = 0; j & 2; j++) {
XixiangModal xixiang = new XixiangModal();
xixiang.setXixiangMember("张三");
xixiang.setXixiangName("开关电源");
xixiang.setXixiangReason("管道线路井内余线没有靠墙");
xixiang.setXixiangResult("不合格");
xixiang.setXixiangTime("日");
xixiangList.add(xixiang);
shiti.setXixiangList(xixiangList);
content.add(shiti);
ExcelHelper eHelper = new ExcelHelper();
// 生成excel中的一张表格
HSSFSheet sheet = eHelper.export(wb, "sheet1", title, content);
// 直接存到服务器端
// FileOutputStream fileO
// fileOut = new FileOutputStream("workbook.xls");
// wb.write(fileOut);
// fileOut.close();
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// 写入输出流
OutputStream os = response.getOutputStream();
wb.write(os);
os.flush();
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
3,相关实体类
package com.bobo.
import java.util.ArrayL
public class ShitiModal {
private String shitiN
private String shitiN
private String shitiP
private String shitiC
private String shitiP
private String shitiT
private String shitiR
private ArrayList&XixiangModal& xixiangL
public String getShitiPerson() {
return shitiP
public void setShitiPerson(String shitiPerson) {
this.shitiPerson = shitiP
public String getShitiTime() {
return shitiT
public void setShitiTime(String shitiTime) {
this.shitiTime = shitiT
public String getShitiResult() {
return shitiR
public void setShitiResult(String shitiResult) {
this.shitiResult = shitiR
public String getShitiNum() {
return shitiN
public void setShitiNum(String shitiNum) {
this.shitiNum = shitiN
public String getShitiName() {
return shitiN
public void setShitiName(String shitiName) {
this.shitiName = shitiN
public String getShitiProvince() {
return shitiP
public void setShitiProvince(String shitiProvince) {
this.shitiProvince = shitiP
public String getShitiCity() {
return shitiC
public void setShitiCity(String shitiCity) {
this.shitiCity = shitiC
public ArrayList&XixiangModal& getXixiangList() {
return xixiangL
public void setXixiangList(ArrayList&XixiangModal& xixiangList) {
this.xixiangList = xixiangL
ShitiModal
package com.bobo.
public class XixiangModal {
private String XixiangN
private String XixiangM
private String XixiangR
private String XixiangT
private String XixiangR
public String getXixiangName() {
return XixiangN
public void setXixiangName(String xixiangName) {
XixiangName = xixiangN
public String getXixiangMember() {
return XixiangM
public void setXixiangMember(String xixiangMember) {
XixiangMember = xixiangM
public String getXixiangResult() {
return XixiangR
public void setXixiangResult(String xixiangResult) {
XixiangResult = xixiangR
public String getXixiangTime() {
return XixiangT
public void setXixiangTime(String xixiangTime) {
XixiangTime = xixiangT
public String getXixiangReason() {
return XixiangR
public void setXixiangReason(String xixiangReason) {
XixiangReason = xixiangR
XixiangModal
4,ExcelHelper类
package com.bobo.
import java.util.ArrayL
import org.apache.poi.hssf.usermodel.HSSFC
import org.apache.poi.hssf.usermodel.HSSFCellS
import org.apache.poi.hssf.usermodel.HSSFR
import org.apache.poi.hssf.usermodel.HSSFS
import org.apache.poi.hssf.usermodel.HSSFW
import org.apache.poi.hssf.util.HSSFC
import org.apache.poi.ss.util.CellRangeA
import com.bobo.modal.ShitiM
import com.bobo.modal.XixiangM
public class ExcelHelper {
public HSSFSheet export(HSSFWorkbook wb, String fileName, String[] title,
ArrayList&ShitiModal& content) {
// int cellNum = 5; //设置列数
* 建立表格设置。
HSSFSheet sheet = null;
sheet = wb.createSheet(fileName);
int columnSize = title.
HSSFRow row_one = sheet.createRow(0);
for (int i = 0; i & columnS i++) {
HSSFCell cell = row_one.createCell(i);
cell.setCellValue(title[i]);
int curRow = 1;
int endRow = 1;
int temp = curR
for (int i = 0; i & content.size(); i++) {
temp = curR
ShitiModal shiti = content.get(i);
int xixiangNum = content.get(i).getXixiangList().size();
endRow += xixiangN
for (; curRow & endR curRow++) {
// 设置需要合并的单元格部分
for (int k = 0; k & 7; k++) {
CellRangeAddress cra = new CellRangeAddress(curRow,
endRow - 1, k, k);
sheet.addMergedRegion(cra);
HSSFRow row = sheet.createRow(curRow);
if (curRow == temp) {
row.createCell(0).setCellValue(shiti.getShitiNum());
row.createCell(1).setCellValue(shiti.getShitiName());
row.createCell(2)
.setCellValue(shiti.getShitiProvince());
row.createCell(3).setCellValue(shiti.getShitiCity());
row.createCell(4).setCellValue(shiti.getShitiPerson());
row.createCell(5).setCellValue(shiti.getShitiResult());
row.createCell(6).setCellValue(shiti.getShitiTime());
// 开始添加细分
XixiangModal xixiang = shiti.getXixiangList().get(
curRow - temp);
row.createCell(7).setCellValue(xixiang.getXixiangName());
row.createCell(8).setCellValue(xixiang.getXixiangMember());
row.createCell(9).setCellValue(xixiang.getXixiangResult());
row.createCell(10).setCellValue(xixiang.getXixiangTime());
row.createCell(11).setCellValue(xixiang.getXixiangReason());
curRow = endR
} catch (Exception ex) {
ex.printStackTrace();
} // end of export
阅读(...) 评论()开发可复用的从Domino中导出数据到Excel的类 - 生鱼片 - 博客园
posts - 234, comments - 1672, trackbacks - 55, articles - 12
在domino开发中我们不可避免的要和报表打交道,一般就是生成各种Excel报表,本人主要为了自己在开发中方便,简单实现了一个基本类,现在功能有限,当然这个类我慢慢的根据以后遇到的需求逐渐完善。
Const EXCEL_APPLICATION&&&&&&& =&"Excel.application"
Private&Const BASEERROR&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& =&<SPAN style="COLOR: #00 'Private Const ERROR_NOSUCHCELL&&&&&&&&&&&&&&&&&&&&&&&&&&& = BASEERROR + 0 'Private Const ERRORTEXT_NOSUCHCELL&&&&&&&&&&&&&&&&&&& = "Excel Report - Could not get data from cell."
Const REG_97&&&&&&&&&&& =&"Software\\Microsoft\\Office\\8.0\\Common\\InstallRoot"&&&&&&&&&&&&&&&&&&& 'Registry Key Office 97 Const REG_2000&&&&&&& =&"Software\\Microsoft\\Office\\9.0\\Common\\InstallRoot"&&&&&&&&&&&&&&&&&&& 'Registry Key Office 2000 Const REG_XP&&&&&&&&&&& =&"Software\\Microsoft\\Office\\10.0\\Common\\InstallRoot"&&&&&&&&&&&&&&&&&&& 'Registry Key Office XP Const REG_2003&&&&&&& ="Software\\Microsoft\\Office\\11.0\\Common\\InstallRoot"&&&&&&&&&&&&&&&&&&& 'Registry Key Office 2003
Const NAME_97&&&&&&& =&"Office 97" Const NAME_2000&&&&&&& =&"Office 2000" Const NAME_XP&&&&&&& =&"Office XP" Const NAME_2003&&&&&&& =&"Office 2003"
Class ExcelHelperClass ExcelHelper &&&& &&& Private xlApp As Variant&&&&&&&&&&&&&&&&&&& ' Application object &&& Private strFilePath As&String&&&& &&&& &&& Sub new()Sub&new(xlFilename As&String, isVisible As&Boolean) &&&&&&& On&Error&Goto GeneralError&&&&&&&& &&&&&&& Set xlApp =&CreateObject(EXCEL_APPLICATION)&&&&&&& ' open the application &&&&&&& xlApp.Workbooks.Add xlFilename&&&&&&&&&&&&&&&&&&&&&&&&&&& ' create an Excel workbook &&&&&&& xlApp.Visible = isVisible&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ' make it visible (or not) &&&&&&& strFilePath = xlFilename&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ' store the filename&&&&&&& &&&&&&& Goto ExitSub &&&&&&&& GeneralError: &&&&&&& If&Not (xlApp Is&Nothing) Then xlApp.quit&&&&&&&&&&&&&&&&&&& ' quit, if there is an error &&&&&&& Resume ExitSub&&&&&&&& ExitSub: &&& End Sub&&&& &&&& &&& Public&Function save()Function save &&&&&&& xlApp.ActiveWorkbook.SaveAs( strFilePath ) &&& End Function&&&& &&&& &&& Public&Function saveAs()Function saveAs(newFilename) &&&&&&& xlApp.ActiveWorkbook.SaveAs( newFileName ) &&& End Function&&&& &&&& &&& Public&Function setCell()Function setCell( Sheet As Variant , row As&Integer , column As Variant , value As Variant ) &&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Cells( row , column ).Value = value &&& End Function &&&& &&& Public&Function getCell()Function getCell( Sheet As Variant , row As&Integer , column As Variant ) As&String &&&&&&& On&Error&Goto GeneralError &&&&&&& getCell = xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Cells( row , column ).Value &&&&&&& Goto ExitSub&&&&&&&& GeneralError: &&&&&&& getCell =&"" &&&&&&& Resume ExitSub&&&&&&&& ExitSub:&&&&&&&& &&& End Function&&&& &&&& &&& Public&Function quit()Function quit &&&&&&& If&Not (xlApp Is&Nothing) Then &&&&&&&&&&& xlApp.Quit &&&&&&&&&&& Set xlApp =&Nothing&&&& &&&&&&& End&If &&& End Function&&&& &&&& &&& Public&Function setVisibility()Function setVisibility(isVisible As&Boolean) &&&&&&& If (isVisible And&Not xlApp.Visible)&&&& Then&&&& xlApp.Visible =&True &&&&&&& If (Not isVisible And xlApp.Visible)&&& Then&&&&&&& xlApp.Visible =&False &&& End Function &&&& &&& Public&Function setSheetName()Function setSheetName(Sheet As Variant,sheetName As&String) &&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Select &&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Name=sheetName &&& End Function &&&& &&& Public&Function setCellColor()Function setCellColor(Sheet As Variant, row As&Integer, column As Variant, innercolor As Variant) &&&&&&& On&Error&Goto GeneralError&&&&&&&& &&&&&&& If&Cstr(innercolor) &&&""&Then &&&&&&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Cells( row , column ).Interior.ColorIndex = innercolor&&&& &&&&&&& End&If&&&&&&&& &&&&&&& Goto ExitSub&&&&&&&& GeneralError: &&&&&&& Resume ExitSub&&&&&&&& ExitSub: &&& End Function&&&& &&&& &&& Public&Function setCellFont()Function setCellFont(Sheet As Variant, row As&Integer, column As Variant, style As Variant, size As Variant, color As Variant) &&&&&&& On&Error&Goto GeneralError&&&&&&&& &&&&&&& If&Cstr(style) &&&""&Then& &&&&&&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Cells( row , column ).Font.FontStyle&&&&&&&& = style &&&&&&& End&If &&&&&&&& &&&&&&& If&Cstr(size) &&&""&Then &&&&&&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Cells( row , column ).Font.Size&&&&&&&&&&& = size &&&&&&& End&If &&&&&&&& &&&&&&& If&Cstr(color) &&&""&Then &&&&&&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Cells( row , column ).Font.ColorIndex&&&& = color &&&&&&& End&If&&&&&&&& &&&&&&&& &&&&&&& Goto ExitSub &&&&&&&& GeneralError: &&&&&&& Resume ExitSub&&&&&&&& ExitSub: &&& End Function&&&& &&&& &&& Public&Function setRowFont()Function setRowFont(Sheet As Variant, row As&Integer,& style As Variant, size As Variant, color As Variant) &&&&&&& On&Error&Goto GeneralError&&&&&&&& &&&&&&& Dim rowpara As&String &&&&&&& rowpara=Cstr(row)+":"+Cstr(row) &&&&&&&& &&&&&&& If&Cstr(style) &&&""&Then& &&&&&&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Rows(rowpara).Select &&&&&&&&&&& xlApp.Selection.Font.FontStyle&&&& = style &&&&&&& End&If &&&&&&&& &&&&&&& If&Cstr(size) &&&""&Then &&&&&&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Rows(rowpara).Select &&&&&&&&&&& xlApp.Selection.Font.Size&&& = size &&&&&&& End&If &&&&&&&& &&&&&&& If&Cstr(color) &&&""&Then &&&&&&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets( Sheet ).Rows(rowpara).Select &&&&&&&&&&& xlApp.Selection.Font.ColorIndex = color &&&&&&& End&If &&&&&&&& &&&&&&& Goto ExitSub&&&&&&&& GeneralError: &&&&&&& Resume ExitSub&&&&&&&& ExitSub: &&& End Function&&&& &&&& &&& Public&Function getVersion()Function getVersion() As&String&&&&&&&& &&&&&&& On&Error&Goto GeneralError&&&&&&&& &&&&&&& Dim formula As&String &&&&&&& Dim SWVersion As&String &&&&&&& Dim Versions List As&String &&&&&&& Dim v As Variant&&&&&&&& &&&&&&&& &&&&&&& Versions(NAME_97)&&&&&&& = REG_97 &&&&&&& Versions(NAME_2000)&&& = REG_2000 &&&&&&& Versions(NAME_XP)&&&&&&& = REG_XP &&&&&&& Versions(NAME_2003)&&& = REG_2003&&&& &&&&&&&& &&&&&&& Forall vers In Versions &&&&&&&&&&& formula$ = | (@RegQueryValue("HKEY_LOCAL_MACHINE"; "| & vers & |";"Path")) | &&&&&&&&&&& v = Evaluate( formula$ ) &&&&&&&&&&& If v(<SPAN style="COLOR: #) &&&""&Then &&&&&&&&&&&&&&& getVersion = Listtag(vers) &&&&&&&&&&&&&&& Goto ExitSub &&&&&&&&&&& End&If &&&&&&& End Forall &&&&&&&& &&&&&&& getVersion =&""&&&&&&&& &&&&&&& Goto ExitSub &&&&&&&& GeneralError:&&&&&&&& &&&&&&& getVersion =&"" &&&&&&& Resume ExitSub&&&&&&&& ExitSub: &&& End Function&&&& &&&& &&& Public&Function exportNotesView()Function exportNotesView(view As NotesView, Sheet As Variant, OffsetRow As&Integer, OffsetCol As&Integer, isWithheader As&Boolean, includeIcons As&Boolean, includeColors As&Boolean, includeHidden As&Boolean) &&&&&&& Dim viewnav As NotesViewNavigator &&&&&&& Dim entry As NotesViewEntry &&&&&&& Dim viewcolumns As Variant &&&&&&& Dim column As&Integer &&&&&&& Dim row As&Integer&&&&&&&& &&&&&&& Dim i As&Integer &&&&&&& Dim array(<SPAN style="COLOR: #&To&<SPAN style="COLOR: #) As&String &&&&&&& array(<SPAN style="COLOR: #)="A"& &&&&&&& array(<SPAN style="COLOR: #)="B"&& &&&&&&& array(<SPAN style="COLOR: #)="C"& &&&&&&& array(<SPAN style="COLOR: #)="D"& &&&&&&& array(<SPAN style="COLOR: #)="E"& &&&&&&& array(<SPAN style="COLOR: #)="F"& &&&&&&& array(<SPAN style="COLOR: #)="G"& &&&&&&& array(<SPAN style="COLOR: #)="H"& &&&&&&& array(<SPAN style="COLOR: #)="I"& &&&&&&& array(<SPAN style="COLOR: #)="J"&&&&&&&&& &&&&&&&& &&&&&&& Set viewnav&&&& = view.CreateViewNav() &&&&&&& Set entry&&&&&&& = viewnav.GetFirstDocument() &&&&&&& viewcolumns&&& = view.Columns &&&&&&& row&&&&&&&&&&&&&&&& = OffsetRow +&<SPAN style="COLOR: # &&&&&&& column&&&&&&&&&&&& = OffsetCol +&<SPAN style="COLOR: #&&&&&&&& &&&&&&&& &&&&&&& If isWithHeader Then &&&&&&&&&&& Forall vc In viewcolumns &&&&&&&&&&&&&&& Call&Me.setCell(Sheet, row, column, vc.title)&&&& &&&&&&&&&&&&&&& column = column +&<SPAN style="COLOR: # &&&&&&&&&&& End Forall &&&&&&& End&If&&&&&&&&&&&& &&&&&&&& &&&&&&& While&Not (entry Is&Nothing) &&&&&&&&&&& row&&&&&&&&&&&& = row +&<SPAN style="COLOR: # &&&&&&&&&&& column&&&&&&&& = OffsetCol +&<SPAN style="COLOR: # &&&&&&&&&&& Forall cv In entry.ColumnValues &&&&&&&&&&&&&&& If doColumnExport(viewcolumns(column - OffsetCol -&<SPAN style="COLOR: #), includeHidden, IncludeIcons, includeColors) Then &&&&&&&&&&&&&&&&&&& Call&Me.setCell(Sheet, row, column, Cstr(cv))&&&& &&&&&&&&&&&&&&& End&If &&&&&&&&&&&&&&& column = column +&<SPAN style="COLOR: # &&&&&&&&&&& End Forall&&&&&&&&&&&& &&&&&&&&&&& Set entry = viewnav.GetNextDocument(entry) &&&&&&& Wend&&&&&&&& &&&&&&&& &&&&&&& For i=<SPAN style="COLOR: #&To& (column-<SPAN style="COLOR: #)& &&&&&&&&&&& Call&Me.autoFit(Sheet,array(i))&&&&&&&&&&&& &&&&&&& Next&&&& &&&&&&&& &&& End Function &&&& &&& Private&Function doColumnExport()Function doColumnExport (viewcol As NotesViewColumn, includeHidden As&Boolean, IncludeIcons As&Boolean, includeColors As&Boolean) As&Boolean &&&&&&& Dim isHiddenOK&&&& As&Boolean &&&&&&& Dim isIconOK&&&&&&&& As&Boolean &&&&&&& Dim isColorOK&&&&&&&& As&Boolean &&&&&&&& &&&&&&& isHiddenOK = (viewcol.isHidden And IncludeHidden) Or&Not viewcol.isHidden &&&&&&& isIconOK&&& = (viewcol.isIcon And IncludeIcons) Or&Not (viewcol.isIcon) &&&&&&& isColorOK&&& =&True &&&&&&& doColumnExport = isHiddenOK And isIconOK And isColorOK &&& End Function &&&& &&& Public&Function autoFit()Function autoFit(Sheet As Variant,col As&String) &&&&&&& xlApp.Workbooks(<SPAN style="COLOR: #).Worksheets(Sheet).Columns(col+":"+col).EntireColumn.AutoFit &&& End Function &&&& &&&& End Class 测试程序调用的代理代码如下:
Sub Initialize()Sub Initialize&&&& &&& Dim view As NotesView &&& Dim excelfilepath As&String &&& Dim Sheet As Variant &&& Dim OffsetX As&Integer &&& Dim OffsetY As&Integer &&& Dim isWithHeader As&Boolean &&& Dim includeIcons As&Boolean &&& Dim includeColors As&Boolean &&& Dim includeHidden As&Boolean &&& Dim session As&New NotesSession &&& Dim currdb As NotesDatabase&&&& &&&& &&& Const Font_Style&&&&&&&&&&& =&"Bold" &&& Const Font_Size&&&&&&&&&&&&&&& =<SPAN style="COLOR: # &&& Const Font_Color&&&&&&&&&&&&&&& =<SPAN style="COLOR: #&&&&&&&& &&&& &&& Set currdb=session.CurrentDatabase &&& Sheet&&&&&&&&&&&&&&&&&&&& =&<SPAN style="COLOR: # &&& OffsetX&&&&&&&&&&&&&&&&&&& =&<SPAN style="COLOR: # &&& OffsetY&&&&&&&&&&&&&&&&&&& =&<SPAN style="COLOR: # &&& isWithHeader&&&&&&&&&&& =&True &&& includeIcons&&&&&&&&&&& =&True &&& includeColors&&&&&&& =&True &&& includeHidden&&&&&&& =&True &&& excelfilepath&&&&&&&&&&& =&""&&&&&&&&&&& ' create an empty excel file &&&& &&& 'Set view&&&&&&&& = ws.CurrentView.View &&& Set view=currdb.GetView("chunainfo") &&& Set report=&New ExcelHelper("", True) &&&& &&& 'Call report.setCellFont(1, 2, 2, Font_Style, Font_Size, Font_Color) &&&& &&& Call report.setRowFont(<SPAN style="COLOR: #, <SPAN style="COLOR: #, Font_Style, Font_Size, Font_Color) &&& Call report.exportNotesView(view, Sheet, OffsetX, OffsetY, isWithheader, includeIcons, includeColors, includeHidden) &&& Call report.exportNotesView(view, <SPAN style="COLOR: #, OffsetX, OffsetY, isWithheader, includeIcons, includeColors, includeHidden) &&& Call report.setVisibility(True) &&& Call report.setSheetName(Sheet,"请假单") &&& Call report.setSheetName(<SPAN style="COLOR: #,"出差报核单") &&& Msgbox&"成功导出报表" &&&& End Sub 该类还有很多不完善的地方,一点一点慢慢来吧。}

我要回帖

更多关于 小米代码找通话记录 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信