Quantcast
Channel: SCN : Discussion List - PowerBuilder Developer Center
Viewing all articles
Browse latest Browse all 2881

what I have done wrong?I try to export the RTE to a MS-WORD file,but nothing in it.

$
0
0

hello sir/madam

    I try the following code,my purpose was I tried to export a Rich Text Datawindows to a MS-Word file,when the file have exported,there's nothing on it,I don't know what I have done wrong

//dw_exp is datawindow which is rich text datawindow

//rte_exp is rich text edit which I tried to export to a ms-word file

//dw_sub is the source that I trie to replace some text in dw_exp with.

//my

 

value = getfilesavename( "SAVEAS" ,path,name, "doc" , "Word files( *.doc),*.doc" )

 

if value=1 then

         dw_exp.reset()

         dw_exp.retrieve(ld_caseid)//I can't see the records appeared when it executed here.but actually there's a record in the table,just can't figure it out

         rte_exp.Clear()

         string ls_richtext

         string ls_prodname,ls_gjfzlx,ls_batch,ls_jx

         decimal ld_nxl,ld_ncl

         long ll_thenumber

         ls_richtext=dw_exp.CopyRTF()

         rte_exp.PasteRTF( ls_richtext)

         rte_exp.SetRedraw(False)

 

//the follwoing code I just tried to replace some text on the RTE control

         ll_type1count=0

          ll_type2count=2

      

                 for li_rowsub=1 to dw_sub.rowcount()

            ls_type=dw_sub.getitemstring(li_rowsub,"thetype")

             ls_prodname=dw_sub.getitemstring(li_rowsub,"prod_name")

             ls_gjfzlx=dw_sub.getitemstring(li_rowsub,"gjzlm")

             ls_batch=dw_sub.getitemstring(li_rowsub,"ph")

             ls_jx=dw_sub.getitemstring(li_rowsub,"jx")

              ld_nxl=dw_sub.getitemdecimal(li_rowsub,"nxsl")

              ld_ncl=dw_sub.getitemdecimal(li_rowsub,"ncl")

            if isnull(ls_type) then

                ll_type1count++

                ll_thenumber=ll_type1count

          

            else

                ll_type2count++  

                ll_thenumber=ll_type2count

            end if

         Integer  li_Loc

          li_Loc =rte_exp.Find("name"+string(ll_thenumber), True, &

                  true, &

                   true, True )

           if  li_Loc > 0 then

                rte_exp.ReplaceText(ls_prodname )

              

            end if

             li_Loc =rte_exp.Find("prodname"+string(ll_thenumber), True, &

                  true, &

                   true, True )

           if  li_Loc > 0 then

                rte_exp.ReplaceText( ls_gjfzlx )

              

            end if

          

             li_Loc =rte_exp.Find("batch"+string(ll_thenumber), True, &

                  true, &

                   true, True )

           if  li_Loc > 0 then

                rte_exp.ReplaceText( ls_batch )

              

            end if

          

             li_Loc =rte_exp.Find("jx"+string(ll_thenumber), True, &

                  true, &

                   true, True )

           if  li_Loc > 0 then

                rte_exp.ReplaceText( ls_jx )

              

            end if

          

             li_Loc =rte_exp.Find("sellanu"+string(ll_thenumber), True, &

                  true, &

                   true, True )

           if  li_Loc > 0 then

                rte_exp.ReplaceText(string(ld_nxl) )

              

            end if

                 li_Loc =rte_exp.Find("produceanu"+string(ll_thenumber), True, &

                  true, &

                   true, True )

           if  li_Loc > 0 then

                rte_exp.ReplaceText(string(ld_ncl) )

              

            end if

                       

                       

      

           next

          

          

       

  

       rte_exp.SaveDocument(path,FileTypeDoc! )

       

     end if

 

thanks

regards

Ken


Viewing all articles
Browse latest Browse all 2881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>