How to play the Excel file

Source: Internet
Author: User
Tags dedicated server ticket

We usually put the file into a dedicated server or cluster, complex points such as Fastdfs, HDFs cluster. Simple point to operate the disk file directly via FTP. This article focuses on demonstrating how to play Excel, so put applications and files directly into the same machine.
Let's look at an effect chart and draw out the requirements:

According to the static information of the line site, the adjacency matrix of the starting and ending sites is generated, the fare of XX station to XX station is the matrix value, and the style is generated according to the color rules of the fare, so as to facilitate the visual observation of its jump result. How do we implement the diagram requirements? can be implemented using Java POI operations Excel files.
Need data: ① line code, site code, site name, ② site-> site: ticket price;

Ideas:
① first, generate the row title bar, which is the first three line headings;
② which, the first three rows three columns of information is static (fixed value), followed by rows of dynamic values (from the DTO assigned);
③ establishes the line-> style hashmap, assigns the color to the line area;
After the ④ is established, the horizontal & vertical title bar should be merged into the cell by the line number;
⑤ also need to consider the horizontal & vertical title bar freeze rolling problem;
⑥ vertical title bar and content area, synthesized from DTO object;
⑦ each Dto object needs to contain vertical title bar properties and value sequences;
⑧ Vertical title bar using rule 1, Value sequence using rule 2;
⑨ the cells in turn to produce the Excel file as shown above.

requirements: fixed static information, which is pieced together according to the site order of metro lines, is used to assist the adjacency matrix of production rules. In the subway line map, the site and site is a map, according to the different algorithm types, you can calculate the site to the site of the lowest ticket prices, the shortest path, time is minimal ...

public void Saveexcel (string title, list<list<stationexceldto>> result, list<string> headers, string
    Docpath, String fileName) {OutputStream stream = null;
    The file's parent path String FilePath = Docpath + fileName;
    File Excelparentpath = new file (Docpath);

    File Excelfile = new file (FilePath); 
        try {///first determine that the directory in which Excel is stored does not exist, but first create an if (!excelparentpath.exists ()) {excelparentpath.mkdirs ();
        //To determine that the file does not exist, then create an if (!excelfile.exists ()) {excelfile.createnewfile ();
        ///Create write file stream = new FileOutputStream (FilePath);
    Call the method that generates Excel Exportexcel (title, headers, result, stream);
    catch (FileNotFoundException e) {e.printstacktrace ();
    catch (IOException e) {e.printstacktrace ();
            }finally {if (stream!= null) {try {stream.close (); catch (IOException e) {E.prinTstacktrace (); }
        }
    }
}

To be Continued ...

Fastdfs+nginx (single point of deployment) case
Https://www.cnblogs.com/cnmenglang/p/6251696.html

Author: @nanphonfy
Reprint Source: Http://blog.csdn.net/nanphonfy

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.