public void ScriptureExportTest() { string inputSourceDirectory = FileInput("ExportLO"); string outputDirectory = FileOutput("ExportLO"); if (Directory.Exists(outputDirectory)) { Directory.Delete(outputDirectory, true); } FolderTree.Copy(inputSourceDirectory, outputDirectory); Param.LoadSettings(); _projInfo.ProjectPath = outputDirectory; _projInfo.ProjectInputType = "Scripture"; _projInfo.DefaultXhtmlFileWithPath = Common.PathCombine(outputDirectory, "ScriptureInput.xhtml"); _projInfo.DefaultCssFileWithPath = Common.PathCombine(outputDirectory, "ScriptureInput.css"); _projInfo.OutputExtension = "odt"; EnableConfigurationSettings(outputDirectory); var target = new ExportLibreOffice(); const bool expectedResult = true; bool actual = target.Export(_projInfo); Assert.AreEqual(expectedResult, actual); }
public void MasterDocument() { ExportLibreOffice exportOpenOffice = new ExportLibreOffice(); var projInfo = new PublicationInformation(); CopyInputToOutput(); string lexiconFull = FileOutput("main.xhtml"); string revFull = FileOutput("FlexRev.xhtml"); string lexiconCSS = FileOutput("main.css"); string revCSS = FileOutput("FLExRev.css"); ProgressBar pb = new ProgressBar(); projInfo.ProgressBar = pb; //projInfo.ProjectFileWithPath = _projectFile; projInfo.IsLexiconSectionExist = File.Exists(lexiconFull); projInfo.IsReversalExist = File.Exists(revFull); //projInfo.IsReversalExist = Param.Value[Param.ReversalIndex] == "True"; projInfo.SwapHeadword = false; projInfo.FromPlugin = true; projInfo.DefaultCssFileWithPath = lexiconCSS; projInfo.DefaultRevCssFileWithPath = revCSS; projInfo.DefaultXhtmlFileWithPath = lexiconFull; projInfo.ProjectInputType = "Dictionary"; projInfo.DictionaryPath = Path.GetDirectoryName(lexiconFull); projInfo.ProjectName = Path.GetFileNameWithoutExtension(lexiconFull); exportOpenOffice.Export(projInfo); Assert.IsTrue(CheckFileExist(), "Master Document Failed."); }
private void XslProcess(KeyValuePair<string, string> subSection, string fileName, string xslFileName, ExportLibreOffice exportLibreOffice, ProgressBar statusProgressBar) { bool generated; if (_dictStepFilenames.ContainsKey(subSection.Key)) { var tempDict1 = new Dictionary<string, string>(); tempDict1 = _dictStepFilenames[subSection.Key]; foreach (KeyValuePair<string, string> tempString in tempDict1) { xslFileName = tempString.Value; } } if (_dictLexiconPrepStepsFilenames.Count > 0) { xslFileName = _dictLexiconPrepStepsFilenames["Filter Entries"]; } string returnFileName = Common.XsltProcess(fileName, xslFileName, ".xhtml"); if (!Path.IsPathRooted(returnFileName)) { var msg = new[] { returnFileName }; LocDB.Message("defErrMsg", returnFileName, msg, LocDB.MessageTypes.Error, LocDB.MessageDefault.First); } if (returnFileName != "") { publicationInfo.ProgressBar = statusProgressBar; publicationInfo.IsOpenOutput = false; generated = ExportODT(publicationInfo); if (generated) { returnFileName = Path.GetFileName(returnFileName); _odtFiles.Add(Path.ChangeExtension(returnFileName, ".odt")); } } }
private void ExportODM(ProgressBar statusProgressBar) { Common.ShowMessage = false; _odtFiles.Clear(); var exportProcess = new ExportLibreOffice(); string LexiconFileName = string.Empty; publicationInfo.IsODM = true; foreach (KeyValuePair<int, Dictionary<string, string>> keyvalue in _dictSorderSection) { var Sections = keyvalue.Value; foreach (var subSection in Sections) { if (subSection.Value != "none") { //string fileName = Path.GetFileName(subSection.Value); string fileName = subSection.Value; publicationInfo.AddFileToXML(fileName, "False", true, "", false, true); fileName = Common.PathCombine(publicationInfo.DictionaryPath, Path.GetFileName(fileName)); string fileExt = Path.GetExtension(fileName); string xslFileName = ""; bool generated = false; switch (fileExt) { case ".xml": if (subSection.Key != "Main") { XslProcess(subSection, fileName, xslFileName, exportProcess, statusProgressBar); } break; case ".xhtml": if (subSection.Key == "Main") { LexiconFileName = fileName; } publicationInfo.DefaultXhtmlFileWithPath = fileName; publicationInfo.ProgressBar = statusProgressBar; publicationInfo.IsOpenOutput = false; generated = ExportODT(publicationInfo); if (generated) { string returnFileName = Path.GetFileName(fileName); _odtFiles.Add(Path.ChangeExtension(returnFileName, ".odt")); } break; case ".lift": if (subSection.Key == "Main") { LexiconFileName = fileName; } XslProcess(subSection, fileName, xslFileName, exportProcess, statusProgressBar); publicationInfo.DefaultXhtmlFileWithPath = fileName; break; case ".odt": _odtFiles.Add(Path.GetFileName(fileName)); break; default: break; } } else if (subSection.Key == "Blank") { _odtFiles.Add("Blank.odt"); // Blank ODT Files } } } // Finally run the ODM file Common.ShowMessage = true; // used to control MessageBox; publicationInfo.DefaultXhtmlFileWithPath = LexiconFileName; publicationInfo.DictionaryOutputName = publicationInfo.ProjectName; publicationInfo.ProgressBar = statusProgressBar; publicationInfo.FileSequence = _odtFiles; publicationInfo.IsOpenOutput = true; ExportODT(publicationInfo); }
private bool LOPreview(PublicationInformation projInfo) { bool success = false; ExportLibreOffice openOffice = new ExportLibreOffice(); success = openOffice.Export(projInfo); return success; }
private void button4_Click(object sender, EventArgs e) { if (!File.Exists(txtInputPath.Text)) { MessageBox.Show("Please enter the valid XHTML path"); return; } if (!File.Exists(txtCSSInput.Text)) { MessageBox.Show("Please enter the valid CSS path"); return; } ExportLibreOffice exportOdt = new ExportLibreOffice(); PublicationInformation projInfo = new PublicationInformation(); string ProjType = "Dictionary"; if (radScripture.Checked) { ProjType = "Scripture"; } projInfo.FinalOutput = "odt"; projInfo.ProjectInputType = ProjType; projInfo.ProjectPath = Path.GetDirectoryName(txtInputPath.Text); projInfo.DictionaryPath = Path.GetDirectoryName(txtInputPath.Text); projInfo.DefaultXhtmlFileWithPath = txtInputPath.Text; projInfo.DefaultCssFileWithPath = txtCSSInput.Text; projInfo.ProgressBar = new ProgressBar(); projInfo.DictionaryOutputName = "test"; ProjType = Common.GetProjectType(projInfo.DefaultXhtmlFileWithPath); projInfo.ProjectInputType = ProjType; exportOdt.Export(projInfo); }