Java得到系统剪贴板&获取桌面路径&生成Excel文件
2017-03-13 22:24
471 查看
得到系统剪贴板
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); // 得到系统剪贴板 StringSelection selection = new StringSelection(text); clipboard.setContents(selection, null);
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();//获取桌面路径 String desktopPath = desktopDir.getAbsolutePath(); File dir = new File(desktopPath + "\\" + id); if (!dir.exists()) { dir.mkdirs(); } //生成Excel文件 PrintStream passExam = new PrintStream( new FileOutputStream(newFile(dir.getAbsolutePath() + "\\" + "补考通过.xls"))); PrintStream notPassExam = new PrintStream( new FileOutputStream(new File(dir.getAbsolutePath() + "\\" + "补考未通过.xls"))); PrintStream finalReport = new PrintStream( new FileOutputStream(new File(dir.getAbsolutePath() + "\\" + "最终成绩单.xls"))); notPassExam.println(i++ + "\t" + course.getCname() + "\t" + course.getTime() + "\t" + course.getScore()); passExam.println(j++ + "\t" + course.getCname() + "\t" + course.getTime() + "\t" + course.getScore()); finalReport.println(i++ + "\t" + course.getCname() + "\t" + course.getTime() + "\t" + course.getScore()); notPassExam.close(); passExam.close(); finalReport.close();
相关文章推荐
- Java得到系统剪贴板&获取桌面路径&生成Excel文件
- java获取系统路径字体、得到某个目录下的所有文件名、获取当前路径
- Control Study -> 用获取路径方法得到圆形窗体(如将: PictureBox变成圆形)
- C#获取用户桌面等特殊系统路径
- C#获取DLL、程序路径,C#获取桌面、收藏夹等特殊系统路径
- 用java获取并传出虚拟机系统实时性能参数(1:得到性能参数)
- 【java&JSP】中获取工程路径的各种方法
- Control Study -> 用获取路径方法得到圆形窗体(如将: PictureBox变成圆形)
- VC 获取系统特殊文件夹的路径如:系统目录,桌面等
- Java在不同环境下获取当前路径的方法--this.getClass().getResource("")
- VC 获取系统特殊文件夹的路径如:系统目录,桌面等
- C#获取用户桌面等特殊系统路径
- 获得系统特殊路径函数SHGetSpecialFolderLocation()获取当前用户桌面
- python获取当前系统的桌面的路径的四种方法
- 相对路径获取JAVA配置文件Class.getResourceAsStream() & ClassLoader的getResourceAsStream()
- C#获取用户桌面等特殊系统路径
- VC 获取系统特殊文件夹的路径如:系统目录,桌面等
- 获取当前系统桌面路径(C# 代码)
- VC 获取系统特殊文件夹的路径如:系统目录,桌面等
- VC 获取系统特殊文件夹的路径如:系统目录,桌面等