예제 #1
0
        public void WriteRtf(string fileName, string sdlxliffFilePath, Dictionary <string, Dictionary <string, ParagraphUnit> > fileParagraphUnits
                             , CultureInfo sourceCulture, CultureInfo targetCulture, bool saveAsDocX
                             , bool includeLegacyStructure)
        {
            SegmentsExported    = 0;
            SegmentsNotExported = 0;

            var rtf = new RTF.Processor();

            rtf.WriteRtf(fileName, sdlxliffFilePath, fileParagraphUnits, sourceCulture, targetCulture, includeLegacyStructure);

            SegmentsExported    = rtf.SegmentsExported;
            SegmentsNotExported = rtf.SegmentsNotExported;

            var currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture;

            try
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

                var word = new Word.Processor();
                word.SaveAsDocument(fileName, saveAsDocX);
                File.Delete(fileName);
            }
            finally
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = currentCulture;
            }
        }
예제 #2
0
        public Dictionary <string, ParagraphUnit> ReadRtf(string rtfFile)
        {
            var rtf = new RTF.Processor();

            Dictionary <string, ParagraphUnit> paragraphUnits;

            try
            {
                rtf.Progress += counter_Progress;

                paragraphUnits = rtf.ReadRtf(rtfFile);
            }
            finally
            {
                rtf.Progress -= counter_Progress;
            }

            return(paragraphUnits);
        }