Jump to content
Sign in to follow this  
Suppir

GuiRichEdit. My tables are crushing!

Recommended Posts

Suppir

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.