Пример #1
0
        //string docxSource = filename with path
        private void GenerateReportFromDocxToDocX(string docxSource, string docxTarget, Placeholders rep)
        {
            var docx = new DocXHandler(docxSource, rep);
            var ms   = docx.ReplaceAll();

            StreamHandler.WriteMemoryStreamToDisk(ms, docxTarget);
        }
Пример #2
0
        private void PrintDocx(string templateFile, string printername, Placeholders rep)
        {
            var docx            = new DocXHandler(templateFile, rep);
            var ms              = docx.ReplaceAll();
            var tempFileToPrint = Path.ChangeExtension(Path.GetTempFileName(), ".docx");

            StreamHandler.WriteMemoryStreamToDisk(ms, tempFileToPrint);
            LibreOfficeWrapper.Print(tempFileToPrint, printername, _locationOfLibreOfficeSoffice);
            File.Delete(tempFileToPrint);
        }
Пример #3
0
        private void GenerateReportFromDocxToHtml(string docxSource, string htmlTarget, Placeholders rep)
        {
            var docx    = new DocXHandler(docxSource, rep);
            var ms      = docx.ReplaceAll();
            var tmpFile = Path.Combine(Path.GetDirectoryName(htmlTarget), Path.GetFileNameWithoutExtension(docxSource) + Guid.NewGuid().ToString().Substring(0, 10) + ".docx");

            StreamHandler.WriteMemoryStreamToDisk(ms, tmpFile);
            LibreOfficeWrapper.Convert(tmpFile, htmlTarget, _locationOfLibreOfficeSoffice);
            File.Delete(tmpFile);
        }