Jump to content

GuiRichEdit. My tables are crushing!


Suppir
 Share

Recommended Posts

Hello!

I want to use regular expressions to change text in GuiRichEdit control. But it works fine only outside ms-word tables. These tables are crushing into plain text :)

Look at this code:

#include <UDF\GuiRichEdit.au3>
#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 800, 600, 300, 200)
$hRichEdit = _GUICtrlRichEdit_Create($Form1, "", 0, 0, 800, 600)
GUISetState(@SW_SHOW)

HotKeySet("^x", "_Replace")
HotKeySet("{ESC}", "_Exit")

Global $Records
Global $Search[1000][2]
Global $Matches
Global $i, $IN

TrayTip ("AutoIt", "Started", 1)
sleep(2000)
TrayTip("clears any tray tip","",0)

While 1
    Sleep(100)
    
WEnd

Func _Replace()
    
    Local $i
    $Text = _GUICtrlRichEdit_GetCtrlText($hRichEdit)
    
;~  HERE IS THE PROBLEM!  
    $Text = StringRegExpReplace($Text, "a", "b")
    _GuiCtrlRichEdit_AppendText($hRichEdit, $Text)
;~  THE TABLE IS NOT MS-WORD-TYPE ANYMORE
    
    TrayTip ("AutoIt", "Done", 1)
    sleep(1000)
    TrayTip("clears any tray tip","",0)
        
            
EndFunc

Func _Exit()
    TrayTip ("AutoIt", "Exit", 1)
    Sleep(1000)
Exit
EndFunc

1. Run the script

2. Copy into GUI any ms-word table

3. Press CTRL+x

4. You see - the table is crushed

5. Press ESC to exit

Is there some way to save tables?

Edited by Suppir
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...