/** * Export a party sheet for the party to the output file using the pre-registered template. If the * output file is null then a default file will be used based on the party file name and the type * of export template in use. If the output file exists it will be overwritten. * * <p>This method will load the required data for the party, load the characters in the party and * then export the party sheet. * * @param partyFilename The path to the party PCP file. * @param outputFile The path to the output file to be created. May be null. * @return true if the export was successful, false if it failed in some way. */ boolean exportParty(String partyFilename, String outputFile) { File file = new File(partyFilename); if (!PCGFile.isPCGenPartyFile(file)) { Logging.errorPrint("Invalid party file specified: " + file.getAbsolutePath()); return false; } String outFilename = outputFile; if (outFilename == null) { outFilename = generateOutputFilename(partyFilename); } Logging.log( Logging.INFO, "Started export of party " + file.getAbsolutePath() + " using " + exportTemplateFilename + " to " + outFilename); // Load data SourceSelectionFacade sourcesForCharacter = CharacterManager.getRequiredSourcesForParty(file, uiDelegate); SourceFileLoader loader = new SourceFileLoader(sourcesForCharacter, uiDelegate); loader.execute(); // Load party PartyFacade party = CharacterManager.openParty(file, uiDelegate, loader.getDataSetFacade()); // Export party File templateFile = new File(exportTemplateFilename); File outFile = new File(outFilename); if (isPdf) { return exportPartyToPDF(party, outFile, templateFile); } else { return exportPartyToNonPDF(party, outFile, templateFile); } }