public static void saveDocToFile(Document doc, IFile file) {
		OutputStream os = null;
		try {
			File renewFile = file.getLocation().toFile();
			if (!renewFile.exists()) {
				renewFile.createNewFile();
			}
			if (!renewFile.canWrite()) {
				renewFile.setWritable(true);
			}
			os = new BufferedOutputStream(new FileOutputStream(renewFile));
			DocumentHelper.write(doc, os);
		} catch (Throwable e) {
			e.printStackTrace();
		} finally {
			if (os != null) {
				try {
					os.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}