PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
WD Management of RTF
Published by Boller
in the category Tools
New features



Description
WD Management of RTF


// ----------------------------------------------------------------
// ----------------------- RUN CODE ---------------------------
// ----------------------------------------------------------------

// Choose or save the file
sFileName is string = fSelect(CompleteDir(fExeDir()),"overview.rtf","Selecting RTF files","RTF file (*.RTF)" + TAB + "*.rtf" , "*.rtf" ,fselCreate)

// Save the file
fSaveText(sFileName,Edit_RTF_ORIGINAL)
IF ErrorOccurred THEN
Error(StringBuild("The %1 file was not saved.",sFileName),ErrorInfo())
RETURN
END


//-------------------------------------------------------


// ----------------------------------------------------------------
// ----------------------- RUN CODE ---------------------------
// ----------------------------------------------------------------

// Select a .RTF file
sFileName is string = fSelect(CompleteDir(fExeDir()),"overview.rtf","Selecting RTF files","RTF file (*.RTF)" + TAB + "*.rtf" ,"*.rtf",fselOpen)


IF sFileName~="" THEN
// No selected file
RETURN
END

// Load the RTF file
RTFLoad(RTFText,sFileName)
IF ErrorOccurred THEN
Error(StringBuild("The %1 file was not loaded.",sFileName),ErrorInfo())
RETURN
END


//---------------------------------------------------


// ----------------------------------------------------------------
// ----------------------- RUN CODE ---------------------------
// ----------------------------------------------------------------

n is int
sSoughtWord is string = "Overview"
sReplaceWord is string = "OVERVIEW"
// Case-insensitive search starting from the end of selection
n = RTFSearch(RTFText, sSoughtWord,rtfFullWord+rtfCaseSensitive,1)
// If the word was found
IF n <> 0 THEN
// Replaces the word found
RTFReplace(RTFText, sReplaceWord, n, n + Length(sSoughtWord))
END


//------------------------------------------------


// ----------------------------------------------------------------
// ----------------------- RUN CODE ---------------------------
// ----------------------------------------------------------------

n is int
sSoughtWord is string = "powerful"
// Search not sensitive to the case from the beginning of the text
n = RTFSearch(RTFText, sSoughtWord,rtfFullWord,1)
// If the word was found
IF n <> 0 THEN
// The sought word is selected
RTFText..Cursor = n
RTFText..CursorEnd = n + Length(sSoughtWord)
END

//---------------------------------------------


// ----------------------------------------------------------------
// ----------------------- RUN CODE ---------------------------
// ----------------------------------------------------------------


// Modifies the color of the selection
RTFSelection (RTFText, rtfColor, iLightRed)


//-------------------------------------------------------------------------------


// ----------------------------------------------------------------
// ----------------------- RUN CODE ---------------------------
// ----------------------------------------------------------------

// Switches the selection to Arial
RTFSelection(RTFText, rtfFontName, "Arial")


//-------------------------------------------------------------------------


// ----------------------------------------------------------------
// ----------------------- RUN CODE ---------------------------
// ----------------------------------------------------------------


// Switches the font selection to size 24
RTFSelection(RTFText, rtfFontSize, 24)



//---------------------------------------------------------------------


// ----------------------------------------------------------------
// ----------------------- RUN CODE ---------------------------
// ----------------------------------------------------------------


// Writes the selected word in bold
RTFSelection(RTFText, rtfBold, True)



Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
No review or comment? Be the first one!