Hi,

Here i have one document(source file) which is in RTF format (contains
background image and size of the document is 3 MB) and reading this
document and

storing as a another RTF document with adding some message thru
programatically.

when i see created new document size is 3MB. but my requirement is to
reduce the document size.

so i changed source RTF file to Doc format and reduced 60 KB. once i
read this document and created as new doc file with message, then it is
creating properly. but i could n't able to open this document..

and saying following message.

"The document name or  path is not valid"



This is my code..



                        <cfscript>

                                    sStart = "<message>";

                                    sEnd = "</message>";

                                    sCRLF = "\par#chr(13)##chr(10)#";

                                    sMessage = "\par \par \par Dear
Doug,\par \par ramesh test\par \par Thank You\par Robert";

                                    nPlace = 1;

                        </cfscript>

<!---       take any image document as a sourcefile..for your example..
--->                                      

            <cffile action="" file="C:\devfolder\inc\sourcefile.doc"
variable="sFileContents">         

                                                

                         <cfloop condition="nPlace gt 0">

                                    <cfset nStartPos=nPlace>

                                    <cfset
nPlace=findNoCase(sStart,sFileContents,(nStartPos+1))>

                        </cfloop>

                        

                        <cfset
nEndPos=findNoCase(sEnd,sFileContents,(nStartPos+1))>

                        <cfset
sFileContents=left(sFileContents,(nStartPos-1))&sMessage&right(sFileCont
ents,(len(sFileContents)-nEndPos-len(sEnd)+1))>

                                                

                        <cffile action=""> file="C:\devfolder\doc\ramesh.doc" output="#sFileContents#"
addnewline="Yes">

            if i read RTF (3mb) document thru this code.. it is reading
well and creating well with 3MB document.. but we need to reduce the
size of the document..



Any ideas will be greatly appreciated..



Thanks

Ramesh
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to