Hi
How ca I copy-paste the format in wptools?
Like Ctrl-Shift-C in Word
Matthias
Hi
How ca I copy-paste the format in wptools?
Like Ctrl-Shift-C in Word
Matthias
Hi,
That shortcut is not implemented but it is fairly easy to save/apply a set of properties.
You would use the WPSS ("WP Style Sheet") for this, i.e.
LastCopiedStyle := ActiveParagraph.AGetWPSS(false, true, true)
ActiveParagraph.ASetWPSS(LastCopiedStyle )
The WPSS strings are also supported by the TWPAttrInterface, i.e. SelectecedTextAttr!
Julian
Hi
I was unfortunately not succesfull with this.
I don't use styles.
I want to copy the format (like Fontname, Fontstyle)
at the cursor position and paste it later, either
to the current selected text or the active paragraph
(if there is no selection).
Thanks
I did not mean to use styles.
This code will implement Shift+Ctrl+C and V to copy and paste character and paragraph attributes.
I hope this helps,
var CopyAttrString, CopyParAttrString : String;
procedure TSomeForm.WPRichText1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var s,e : TParagraph; sp, ep : Integer;
begin
if (Key = Integer('C')) and (Shift = [ssshift , ssctrl]) then
begin
CopyAttrString := TWPCustomRTFEdit(Sender).TextCursor.CurrentCharAttr.AGetWPSS;
CopyParAttrString := TWPCustomRTFEdit(Sender).ActiveParagraph.AGetWPSS(false, false, true);
Key := 0;
end
else if (Key = Integer('V')) and (Shift = [ssshift , ssctrl]) then
begin
TWPCustomRTFEdit(Sender).TextCursor.CurrAttribute.ASetWPSS( CopyAttrString );
// modifies char attr only
TWPCustomRTFEdit(Sender).ActiveParagraph.ASetWPSS(CopyParAttrString);
// loop selected or partly selected paragraphs
s := TWPCustomRTFEdit(Sender).TextCursor.GetBlockStart(sp);
e := TWPCustomRTFEdit(Sender).TextCursor.GetBlockEnd(ep);
while (s<>nil) do
begin
s.ASetWPSS(CopyParAttrString);
if s=e then break;
s := s.next;
end;
Key := 0;
end
Alles anzeigen
I added the line
if (Key = Integer('V')) ...
Clipboard.AsText := '';
Thanks