Merge RTF files

后端 未结 2 1581
臣服心动
臣服心动 2021-01-18 03:08

I have a set of RTF\'s stored in strings in C# is their a way to merge these into one document for printing as the user wants to print them as one document with the print se

相关标签:
2条回答
  • 2021-01-18 03:41

    Here you go (C# code's included in)

    0 讨论(0)
  • 2021-01-18 03:51

    You would have to remove the trailing } from the first document.

    You would have to remove the {\rtf1... and {fonttbl.. and {colortbl... sections from the second document. Might need to look at any header, margins etc. that you might have.

    Separate them by a \page as you say.

    This assumes the font and color tables are the same.

    Probably better to get the print settings from the user then silently print each document separately, if that's an option.

    Document 1:

    {\rtf1\ansi\ansicpg1252\deff0\deflang5129
    {\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}}
    {\colortbl;\red0\green0\blue0;}
    \margl1134\margr1134\margt1134\margb1134\sectd 
    \pard
    Document One Content
    \line
    }
    

    Document 2:

    {\rtf1\ansi\ansicpg1252\deff0\deflang5129
    {\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}}
    {\colortbl;\red0\green0\blue0;}
    \margl1134\margr1134\margt1134\margb1134\sectd 
    \pard
    Document Two Content
    \line
    }
    

    Merged Documents:

    {\rtf1\ansi\ansicpg1252\deff0\deflang5129
    {\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}}
    {\colortbl;\red0\green0\blue0;}
    \margl1134\margr1134\margt1134\margb1134\sectd 
    \pard
    Document One Content
    
    \page
    
    \pard
    
    Document Two Content
    \line
    }
    
    0 讨论(0)
提交回复
热议问题