当前位置: 首页>>代码示例>>Java>>正文


Java DefaultOfficeManagerConfiguration.setPortNumber方法代码示例

本文整理汇总了Java中org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration.setPortNumber方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultOfficeManagerConfiguration.setPortNumber方法的具体用法?Java DefaultOfficeManagerConfiguration.setPortNumber怎么用?Java DefaultOfficeManagerConfiguration.setPortNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration的用法示例。


在下文中一共展示了DefaultOfficeManagerConfiguration.setPortNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testConvert

import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; //导入方法依赖的package包/类
@Test
	public void testConvert() throws IOException {
//		File inputFile = new File("D:/Workspace/kbase-doc/target/classes/static/DATAS/1512561737109/1.doc");
		File inputFile = new File("D:/Workspace/kbase-doc/target/classes/static/DATAS/1512561737109/1512561737109.html");
		File outputFile = new File("D:/Workspace/kbase-doc/target/classes/static/DATAS/1512561737109/" + Calendar.getInstance().getTimeInMillis() + ".docx");
//		if (!outputFile.exists()){
//			outputFile.createNewFile();
//		}
		DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
		configuration.setPortNumber(8100);
		configuration.setOfficeHome(new File("D:/Program Files/LibreOffice"));

		OfficeManager officeManager = configuration.buildOfficeManager();
        officeManager.start();
        DocumentFormatRegistry formatRegistry = new DefaultDocumentFormatRegistry();
        OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager, formatRegistry);
        
        try {
        	 converter.convert(inputFile, outputFile);
        } catch (Exception e){
        	e.printStackTrace();
		} finally {
            officeManager.stop();
        }
	}
 
开发者ID:ekoz,项目名称:kbase-doc,代码行数:26,代码来源:ConverteTests.java

示例2: convert

import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; //导入方法依赖的package包/类
private void convert(File inputFile, File outputFile){
		DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
		configuration.setPortNumber(8100);
		configuration.setOfficeHome(new File("D:/Program Files/LibreOffice"));
//		configuration.setOfficeHome(new File("D:/Program Files/OpenOffice"));

		OfficeManager officeManager = configuration.buildOfficeManager();
        officeManager.start();
        DocumentFormatRegistry formatRegistry = new DefaultDocumentFormatRegistry();
        OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager, formatRegistry);
        
        try {
        	 converter.convert(inputFile, outputFile);
        } catch (Exception e){
        	e.printStackTrace();
		} finally {
            officeManager.stop();
        }
	}
 
开发者ID:ekoz,项目名称:kbase-doc,代码行数:20,代码来源:ConverteTests.java

示例3: OfficeConService

import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; //导入方法依赖的package包/类
/**
 * 
 * 创建一个新的实例 OfficeConService.
 */
public OfficeConService() {

    DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();

    //设置转换端口,默认为2002
    if (StringUtils.isNotBlank(this.officePort)) {
        configuration.setPortNumber(Integer.parseInt(this.officePort));
        logger.info("office转换服务监听端口设置为:" + this.officePort);
    }

    //设置office安装目录
    if (StringUtils.isNotBlank(officeHome)) {
        configuration.setOfficeHome(new File(this.officeHome));
        logger.info("设置office安装目录为:" + this.officeHome);
    }

    officeManager = configuration.buildOfficeManager();
    documentConverter = new OfficeDocumentConverter(this.officeManager);
}
 
开发者ID:qjx378,项目名称:wenku,代码行数:24,代码来源:OfficeConService.java


注:本文中的org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration.setPortNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。