Phone Address Book Recovery

Source: Internet
Author: User
Tags vcard

Some time ago my brother back up the phone address Book backup is the XLS table format, and now import does not go in, with a variety of software is wrong.

I exported it as a vcard (suffix is vcf), opened in text format and looked under. A vcard is found to be very format-compliant. Suddenly think there is a chance. The ability to attempt to convert an Excel table into a vcard format. and then import.

Begin:vcardn:; mobile customer service;;;;;; TEL; Cell:10086starred:falseuid:514version:3.0rev:20140602end:vcard

Very obvious format, the second line is the name. Tel that line is the number.

The format of the saved table is as follows:

Mobile 10086
China Unicom 10010

In fact, this is very easy. Just fill in the name and number in the VCF format to be able to, and that UID I give directly is the number of loops.

General ideas have, and then to achieve.

1. Read xls, directly with the very old JXL package. Now it seems that it has not been updated. When you start using this operation table, you are prompted unable to recognize OLE stream. Degree Niang tell me, this is because:

What are you using 2007? JXL now stops updating. Can not read and write excel2007 assume that you want to read and write with Apache POI, almost the same way of using Support  2003, 2007 online There are very many instances.
Without words, then open the XLS directly with WPS. Save the XLS as the old version number. Ok.

2. JXL's Grammar,

This article

JXL Manipulating table base syntax

3,buffer Writing Files

This section is able to take a look at a lot of things on the web.


Jxl.jar Baidu Network disk Connection: Poke me to download


Just give the code,

Class Name: Oper.java

Package Core;import Java.io.bufferedwriter;import Java.io.file;import java.io.filewriter;import java.io.IOException ; Import JXL. Cell;import JXL. Sheet;import JXL. Workbook;import Jxl.read.biff.biffexception;public class Oper {void Test () {BufferedWriter Out;try {out = new BufferedWriter (New FileWriter ("Res/test.txt")), Out.write ("hello" + "\ r \ n" + "Hello"); Out.close (); catch (IOException e) {e.printstacktrace ();}} void work () {try {Workbook Book=workbook.getworkbook (new File ("Res/3.xls")); BufferedWriter out=new BufferedWriter (New FileWriter (New File ("RES/OUT.VCF"));//get the first sheetsheet sheet= Book.getsheet (0); for (int i=0;i<231;i++) {Cell Cell1=sheet.getcell (0,i); String name=cell1.getcontents (); Cell Cell2=sheet.getcell (1,i); String phone1=cell2.getcontents (); Cell Cell3=sheet.getcell (2,i); String phone2=cell3.getcontents (); String phone;if (Phone1.equals (")) Phone=phone2;else phone=phone1;out.write (" begin:vcard\r\n "+" N:; " +name+ ";;;;;; \ r\n "+" TEL; CELL: "+phone+" \r\nuid: "+i+" \ r \ n "+" VersiOn:3.0\r\nrev:20140602\r\nend:vcard\r\n "); Out.write (name);} Out.close (); Book.close ();} catch (Biffexception | IOException e) {System.out.println ("not find"); E.printstacktrace ();}} public static void Main (string[] args) {new Oper (). Work ();}}


I've already checked with WPS. There are 231 rows of data, so the loop is 231 times.


The read-in file is/res/3.xls under the project folder, and the output is/res/out.vcf. Then, you can import the folder via various phone assistants.


Phone Address Book Recovery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.