| 
									
										
										
										
											2017-09-05 05:26:50 +00:00
										 |  |  | /* xlsx.js (C) 2013-present  SheetJS -- http://sheetjs.com */
 | 
					
						
							|  |  |  | /* vim: set ts=2: */
 | 
					
						
							|  |  |  | import com.sheetjs.SheetJS;
 | 
					
						
							|  |  |  | import com.sheetjs.SheetJSFile;
 | 
					
						
							|  |  |  | import com.sheetjs.SheetJSSheet;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public class SheetJSRhino {
 | 
					
						
							| 
									
										
										
										
											2018-03-13 02:51:54 +00:00
										 |  |  |   public static void main(String args[]) throws Exception {
 | 
					
						
							|  |  |  |     try {
 | 
					
						
							|  |  |  |       SheetJS sjs = new SheetJS();
 | 
					
						
							| 
									
										
										
										
											2017-09-05 05:26:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 02:51:54 +00:00
										 |  |  |       /* open file */
 | 
					
						
							|  |  |  |       SheetJSFile xl = sjs.read_file(args[0]);
 | 
					
						
							| 
									
										
										
										
											2017-09-05 05:26:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 02:51:54 +00:00
										 |  |  |       /* get sheetnames */
 | 
					
						
							|  |  |  |       String[] sheetnames = xl.get_sheet_names();
 | 
					
						
							|  |  |  |       System.err.println(sheetnames[0]);
 | 
					
						
							| 
									
										
										
										
											2017-09-05 05:26:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 02:51:54 +00:00
										 |  |  |       /* convert to CSV */
 | 
					
						
							|  |  |  |       SheetJSSheet sheet = xl.get_sheet(0);
 | 
					
						
							|  |  |  |       String csv = sheet.get_csv();
 | 
					
						
							| 
									
										
										
										
											2017-09-05 05:26:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 02:51:54 +00:00
										 |  |  |       System.out.println(csv);
 | 
					
						
							| 
									
										
										
										
											2017-09-05 05:26:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 02:51:54 +00:00
										 |  |  |     } catch(Exception e) {
 | 
					
						
							|  |  |  |       throw e;
 | 
					
						
							|  |  |  |     } finally {
 | 
					
						
							|  |  |  |       SheetJS.close();
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2017-09-05 05:26:50 +00:00
										 |  |  | }
 |