static void MergeJson2Docx(Options opts) { opts.InputJsonPath = @"F:\TextTranslator\Final Packet for distribution1.json"; opts.Docx2MergePath = @"F:\TextTranslator\Final Packet for distribution1.docx"; if (opts.InputJsonPath != null && opts.Docx2MergePath != null) { var docTextRunExtractionService = new DocumentTextRunExtractionService(); var docxTextMerger = new DocxTextMerger(docTextRunExtractionService); Json2Docx Json2DocxMerge = new Json2Docx(opts.InputJsonPath, opts.Docx2MergePath, new DocxFileService(), new DocxJsonService(), new MergeService(docxTextMerger)); if (Json2DocxMerge.Response == "Success") { Console.WriteLine(Json2DocxMerge.Response); Console.WriteLine("Exported File Name:"); Console.WriteLine(Json2DocxMerge.FilePath); } else { Console.WriteLine("ERROR: " + Json2DocxMerge.Response); } } else { Console.WriteLine("ERROR: Please enter a valid -i and -t file path"); } }
static void MergeJson2Docx(Options opts) { // opts.InputJsonPath = @"F:\TextTranslator\theotech-docx_translator-54e33cd4e397\theotech-docx_translator-54e33cd4e397\DocxJsonConverter.Tests\TestFiles\TestDocxFile.json"; opts.Docx2MergePath = @"F:\TextTranslator\Final Packet for distribution1.docx"; if (opts.Docx2MergePath != null) { Docx2Json docx2JsonConversion = new Docx2Json(new JsonIoService(), new DocxJsonService(), new DocxFileService()); var result = docx2JsonConversion.ExtractStringsToJsonFile(opts.Docx2MergePath); if (result.Messages.First() == "Success") { Console.WriteLine(result.Messages.First()); Console.WriteLine("Exported File Name:"); Console.WriteLine(result.FullPath); opts.InputJsonPath = result.FullPath; if (opts.InputJsonPath != null && opts.Docx2MergePath != null) { var docTextRunExtractionService = new DocumentTextRunExtractionService(); var docxTextMerger = new DocxTextMerger(docTextRunExtractionService); Json2Docx Json2DocxMerge = new Json2Docx(opts.InputJsonPath, opts.Docx2MergePath, new DocxFileService(), new DocxJsonService(), new MergeService(docxTextMerger)); if (Json2DocxMerge.Response == "Success") { Console.WriteLine(Json2DocxMerge.Response); Console.WriteLine("Exported File Name:"); Console.WriteLine(Json2DocxMerge.FilePath); } else { Console.WriteLine("ERROR: " + Json2DocxMerge.Response); } } else { Console.WriteLine("ERROR: Please enter a valid -i and -t file path"); } } else { Console.WriteLine("ERROR: " + result.Messages.First()); } } else { Console.WriteLine("ERROR: Please enter a valid -i .docx file path"); } }