导入导出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,337人评论了“导入导出Outlook地址薄”

  1. I enjoy you because of your own effort on this blog. My mum loves working on internet research and it’s easy to see why. Most people hear all regarding the lively ways you create helpful tips and tricks by means of this blog and as well cause contribution from people on the situation while our own daughter has always been studying so much. Take pleasure in the rest of the new year. You’re conducting a dazzling job.

  2. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-07-15 10:31:20

  3. I needed to put you this little note so as to say thanks a lot again for all the breathtaking opinions you have documented at this time. This is unbelievably open-handed of you to give without restraint what exactly some people might have offered for an ebook to end up making some cash for themselves, most importantly considering the fact that you could have tried it in case you wanted. These principles additionally worked to become fantastic way to recognize that the rest have the same interest just as my personal own to realize more on the subject of this issue. I’m certain there are several more enjoyable occasions ahead for those who scan your blog.

  4. My wife and i got absolutely joyful that Raymond could carry out his studies through your ideas he acquired out of the weblog. It’s not at all simplistic to just choose to be freely giving secrets and techniques others might have been selling. We know we’ve got the blog owner to be grateful to for this. All of the explanations you have made, the easy web site navigation, the relationships you will give support to engender – it’s got many excellent, and it is helping our son in addition to the family believe that this issue is pleasurable, which is certainly incredibly vital. Many thanks for everything!

  5. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-07-22 11:20:11

  6. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-07-24 15:21:25

  7. I wish to show some appreciation to this writer for rescuing me from this particular issue. As a result of surfing throughout the the web and seeing basics that were not helpful, I believed my life was over. Existing minus the approaches to the issues you have solved through your guide is a serious case, and the kind which may have adversely damaged my career if I hadn’t come across your website. Your actual talents and kindness in controlling a lot of things was important. I’m not sure what I would’ve done if I had not encountered such a solution like this. I can now look forward to my future. Thanks very much for this impressive and results-oriented guide. I won’t think twice to suggest your web site to anyone who will need recommendations on this situation.

  8. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-07-27 15:15:53

  9. I happen to be writing to let you know what a fabulous experience my cousin’s child enjoyed reading yuor web blog. She discovered many details, with the inclusion of what it is like to possess an awesome coaching mindset to get many others completely thoroughly grasp a variety of grueling subject areas. You actually exceeded our desires. Thank you for presenting those informative, dependable, informative and as well as easy tips about your topic to Jane.

  10. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-07-28 11:16:55

  11. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-07-29 09:38:15

  12. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-07-30 09:39:12

  13. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-07-30 17:03:29

  14. Thank you a lot for providing individuals with an extraordinarily spectacular opportunity to read in detail from this blog. It can be very amazing and also jam-packed with a great time for me personally and my office colleagues to search your web site at the very least thrice weekly to read the latest secrets you have. And definitely, we are usually happy for the attractive inspiring ideas you give. Some two tips in this posting are without a doubt the simplest we have all ever had.

  15. I and also my guys were taking note of the nice hints from your site and so then got a horrible suspicion I never expressed respect to the website owner for those secrets. My young men had been consequently excited to learn them and have in effect certainly been enjoying these things. I appreciate you for simply being really considerate as well as for getting some superior resources most people are really needing to understand about. My very own sincere regret for not expressing appreciation to sooner.

  16. I have to express appreciation to this writer just for rescuing me from this difficulty. Because of scouting throughout the the web and finding notions that were not productive, I was thinking my entire life was over. Being alive without the approaches to the issues you’ve fixed by way of this article is a serious case, as well as those that would have in a negative way affected my entire career if I had not noticed your site. The training and kindness in controlling everything was invaluable. I am not sure what I would have done if I hadn’t come upon such a point like this. It’s possible to at this moment look forward to my future. Thanks so much for your impressive and amazing help. I will not hesitate to suggest your web page to anybody who would need recommendations about this subject.

  17. My brother suggested I may like this website. He was totally right. This submit actually made my day. You can not consider just how so much time I had spent for this info! Thank you!
    2020-08-08 09:42:04

  18. I抦 impressed, I must say. Really rarely do I encounter a blog that抯 each educative and entertaining, and let me tell you, you’ve got hit the nail on the head. Your thought is outstanding; the difficulty is something that not sufficient individuals are talking intelligently about. I’m very completely satisfied that I stumbled across this in my seek for one thing regarding this.

发表评论

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