导入导出Outlook地址薄

1.导出
从Outlook选择文本模式导出的地址薄是以”,”分割的,而且大部分导出的地址薄也都是以”,”分割的,这样就可以用String类的split方法,主要的源代码:
[java]
BufferedReader bufReader = new BufferedReader(new InputStreamReader(importFile.getInputStream()));
//BufferedReader bufReader = new BufferedReader(new FileReader(filepath));
String header = bufReader.readLine();
String[] attributes = header.split(split);
String line;
while((line = bufReader.readLine()) != null) {
String[] addressAttributes = line.split(split);
int size = addressAttributes.length;
WdxcAddressbook addbook = new WdxcAddressbook();
for(int i = 0;i < attributes.length;i++) {
if(attributes[i].equalsIgnoreCase(“Name”) || attributes[i].equalsIgnoreCase(“姓名”)) {
if(i < size) {
addbook.setRealname(addressAttributes[i]);
continue;
}
else {
break;
}
}
}
}
bufReader.close();
[/java]

2.导出
导出成Excel格式:
[java]
ExternalContext context =
FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse)context.getResponse();
response.addHeader(“Content-Disposition”,”attachment;filename=wdxcaddressbook.xls”);
response.setCharacterEncoding(“GB2312”);
response.setContentType(“application/ms-excel”);
try {
//PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(“E:addressbook.xls”)));
PrintWriter pw = response.getWriter();
pw.println(“Name” + “t” + “E-mail Address” + “t” + “Mobile Phone” + “t” + “Home Phone” + “t” + “Company” + “t” + “Home Street” + “t” + “Home Postal Code” + “t” + “Personal Web Page” + “t” + “Notes”);
List list = addressbookService.getAddressbookByOwnerAndEmail(this.getPrinciple().getUserid(),null);
for(int i = 0;i < list.size();i++) {
WdxcAddressbook address = (WdxcAddressbook)list.get(i);
pw.print(address.getRealname());
pw.print(“t”);
pw.print(address.getEmail());
pw.print(“t”);
}
}catch()
pw.close();
[/java]

3.存在的问题
但导出的Outlook地址薄是以”,”分割的,如果自己有在地址中有”,”,Outlook会自动在这个字段两端添加”””,所有光用split会有点问题的

1,812人评论了“导入导出Outlook地址薄”

  1. I am also commenting to make you be aware of what a cool encounter our child developed checking yuor web blog. She came to find numerous details, not to mention what it is like to possess an excellent giving style to have many more very easily grasp specific tortuous things. You truly exceeded our expected results. Thank you for displaying those practical, healthy, educational and even unique thoughts on the topic to Emily.

  2. I in addition to my friends were actually studying the nice tips on your web blog and quickly got an awful feeling I had not expressed respect to the web blog owner for those techniques. Most of the ladies had been consequently warmed to read through all of them and have now unquestionably been tapping into them. Thank you for indeed being so thoughtful and also for making a choice on some excellent topics millions of individuals are really desperate to discover. Our own sincere regret for not expressing appreciation to earlier.

  3. I am at a crossroads in my career. I am in the middle of applying for law school, but I really want to write. Is there a field that can combine the two, or do I choose one over the other? I am not looking to practice law, that much I know about myself. I want to do something that is challenging, fun, creative and meaningful. I fear that I have to give up writing in order to fullfill a working life..

  4. Simply desire to say your article is as astonishing. The clarity in your post is just cool and i could assume you are an expert on this subject. Well with your permission let me to grab your feed to keep updated with forthcoming post. Thanks a million and please carry on the enjoyable work.|

  5. I precisely wished to thank you so much all over again. I am not sure what I could possibly have worked on in the absence of the hints documented by you regarding such problem. It actually was a frightening difficulty for me, however , noticing a specialized manner you resolved the issue made me to leap with happiness. Now i am grateful for this help and as well , expect you realize what a great job you are always getting into educating the mediocre ones via your website. Most probably you’ve never come across all of us.

  6. I simply had to thank you so much all over again. I do not know the things I might have tried without these opinions revealed by you about this area. This was a very frightening case for me personally, nevertheless seeing your professional mode you treated it forced me to weep over delight. I will be happier for your work as well as trust you comprehend what a great job you were carrying out instructing the others through the use of your webpage. I’m certain you’ve never come across any of us.

  7. My wife and i were absolutely ecstatic that John could deal with his investigation through your precious recommendations he came across when using the weblog. It’s not at all simplistic to just always be releasing concepts which often the rest have been selling. And we fully grasp we now have the blog owner to thank for this. The type of illustrations you made, the straightforward website menu, the friendships your site assist to engender – it’s got all great, and it is helping our son and us consider that this theme is enjoyable, which is exceptionally vital. Thank you for all!

  8. I would like to express my appreciation to the writer just for rescuing me from such a difficulty. Right after scouting through the the net and obtaining tips that were not pleasant, I was thinking my life was gone. Being alive devoid of the answers to the problems you’ve solved all through the short post is a serious case, and ones which might have in a wrong way affected my career if I had not discovered your web page. That knowledge and kindness in touching the whole lot was useful. I don’t know what I would’ve done if I had not come upon such a solution like this. I am able to at this point look forward to my future. Thanks very much for this impressive and result oriented help. I won’t hesitate to propose your web site to any individual who needs and wants guide on this issue.

  9. I needed to draft you a little bit of observation to be able to give thanks over again relating to the pretty suggestions you’ve shown at this time. It’s quite particularly open-handed of people like you to give without restraint precisely what most people might have distributed as an e-book to help make some bucks on their own, mostly since you could possibly have done it if you ever decided. The good ideas additionally served like a great way to be sure that someone else have the identical passion the same as my own to learn lots more around this problem. I’m sure there are numerous more fun periods ahead for those who examine your website.

  10. I would like to show appreciation to the writer for bailing me out of this type of problem. Just after looking out through the internet and meeting methods that were not helpful, I was thinking my life was over. Existing minus the solutions to the problems you’ve sorted out as a result of your entire write-up is a serious case, as well as the ones which might have in a negative way affected my entire career if I hadn’t discovered your web blog. Your personal understanding and kindness in handling all areas was important. I don’t know what I would’ve done if I had not encountered such a subject like this. It’s possible to at this time look ahead to my future. Thanks for your time so much for the specialized and effective guide. I will not think twice to recommend the website to any person who would need assistance on this topic.

发表评论

邮箱地址不会被公开。 必填项已用*标注