private void addMetadata() { try { DocPropsCorePart docPropsCorePart = wordMLPackage.getDocPropsCorePart(); CoreProperties coreProps = (CoreProperties) docPropsCorePart.getContents(); org.docx4j.docProps.core.ObjectFactory CorePropsfactory = new org.docx4j.docProps.core.ObjectFactory(); org.docx4j.docProps.core.dc.elements.ObjectFactory dcElfactory = new org.docx4j.docProps.core.dc.elements.ObjectFactory(); SimpleLiteral desc = dcElfactory.createSimpleLiteral(); desc.getContent() .add("Created by NextReports Designer" + ReleaseInfoAdapter.getVersionNumber()); coreProps.setDescription(dcElfactory.createDescription(desc)); SimpleLiteral title = dcElfactory.createSimpleLiteral(); title.getContent().add(getDocumentTitle()); coreProps.setTitle(dcElfactory.createTitle(title)); SimpleLiteral author = dcElfactory.createSimpleLiteral(); author.getContent().add(ReleaseInfoAdapter.getCompany()); coreProps.setCreator(author); SimpleLiteral subject = dcElfactory.createSimpleLiteral(); subject .getContent() .add("Created by NextReports Designer" + ReleaseInfoAdapter.getVersionNumber()); coreProps.setSubject(subject); coreProps.setKeywords(ReleaseInfoAdapter.getHome()); } catch (Docx4JException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private void createSummaryInformation(String title) { DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); POIXMLProperties xmlProps = wb.getProperties(); POIXMLProperties.CoreProperties coreProps = xmlProps.getCoreProperties(); coreProps.setTitle(title); coreProps.setCreator(ReleaseInfoAdapter.getCompany()); coreProps.setDescription("NextReports " + ReleaseInfoAdapter.getVersionNumber()); xmlProps .getExtendedProperties() .getUnderlyingProperties() .setApplication("NextReports " + ReleaseInfoAdapter.getVersionNumber()); coreProps.setSubjectProperty( "Created by NextReports Designer" + ReleaseInfoAdapter.getVersionNumber()); coreProps.setCreated(df.format(new Date())); coreProps.setKeywords(ReleaseInfoAdapter.getHome()); }
public void actionPerformed(ActionEvent e) { if (NextReportsUtil.isInnerEdit()) { return; } if (MessageUtil.showReconnect()) { return; } if (queryName == null) { QueryBrowserPanel browser = new QueryBrowserPanel(); dialog = new QueryBrowserDialog(browser); dialog.pack(); dialog.setResizable(false); Show.centrateComponent(Globals.getMainFrame(), dialog); dialog.setVisible(true); // On double click in OpenQuery dialog the dialog is closed and set to null // see comment #2 if (dialog != null) { if (dialog.okPressed()) { queryName = browser.getSelectedName(); queryPath = browser.getSelectedFilePath(); } else { executed = false; return; } } } if (queryName == null) { return; } // comment #2 : for double click in OpenQuery dialog if ((dialog != null) && dialog.isVisible()) { dialog.dispose(); dialog = null; } final QueryBuilderPanel builderPanel = Globals.getMainFrame().getQueryBuilderPanel(); if (!NextReportsUtil.saveYesNoCancel(I18NSupport.getString("open.query.desc"))) { executed = false; return; } // queryPath is null when we use Wizard if (queryPath != null) { byte status = ReportUtil.isValidReportVersion(queryPath); if (ReportUtil.REPORT_INVALID_OLDER == status) { Show.error(I18NSupport.getString("query.version.invalid.older")); return; } else if (ReportUtil.REPORT_INVALID_NEWER == status) { Show.error( I18NSupport.getString( "query.version.invalid.newer", ReleaseInfoAdapter.getVersionNumber())); return; } } Thread executorThread = new Thread( new Runnable() { public void run() { UIActivator activator = new UIActivator(Globals.getMainFrame(), I18NSupport.getString("load.query")); activator.start(); builderPanel.emptyReportAndChart(); Globals.setCurrentReportName(null); Globals.setCurrentReportAbsolutePath(null); Globals.setCurrentChartName(null); Globals.setCurrentChartAbsolutePath(null); Globals.setReportLoaded(false); Globals.setChartLoaded(false); Globals.setInitialQuery(""); // builderPanel.selectDesignerTab(); ReportPersistence repPersist = ReportPersistenceFactory.createReportPersistence( Globals.getReportPersistenceType()); try { final Report report; if (createdReport != null) { report = createdReport; } else { report = repPersist.loadReport(queryPath); } final Map<String, List<CheckListItem>> itemMap = TableUtil.getItemMap(report); if (activator != null) { activator.stop(); activator = null; } SwingUtilities.invokeAndWait( new Runnable() { public void run() { builderPanel.clear(true); if (report.getSql() != null) { builderPanel.selectSQLViewTab(); builderPanel.setUserSql(report.getSql()); } else if (report.getQuery() != null) { builderPanel.drawDesigner(report, itemMap); builderPanel.selectDesignerTab(); itemMap.clear(); } builderPanel.setParameters(report.getParameters()); // builderPanel.selectTreeNode(report.getName(), DBObject.QUERIES); if (selection) { builderPanel.selectTreeNode( report.getName(), queryPath, DBObject.QUERIES); } Globals.setCurrentQueryName(queryName); // System.out.println("---- queryPath="+queryPath); Globals.setCurrentReportAbsolutePath(null); Globals.setCurrentQueryAbsolutePath(queryPath); Globals.getMainMenuBar().newQueryActionUpdate(); Globals.getMainToolBar().newQueryActionUpdate(); Globals.setOriginalSql(builderPanel.getUserSql()); executed = true; afterCreation(); } }); } catch (Exception e1) { Show.error(e1); } finally { queryName = null; if (activator != null) { activator.stop(); } } } }, "NEXT : " + getClass().getSimpleName()); executorThread.start(); }