procedure EditText(var Text: Text; MaxLineStrLen: Integer; MaxTextLen: Integer; ReadOnly: Boolean) TextModified: Boolean
...
field(10; "Text"; Text[1000])
{
DataClassification = CustomerContent;
Caption = 'Text', Comment = 'DEU="Text"';
}
field(15; "Starting Date"; Date)
{
...
Since a starting date and an ending date can be added to each text line in addition to the text and the text field itself is large enough, the following simple solution was chosen here, which does not split the text into several lines. A line break in the text is still possible.
It is important that the text field in the page is set to Editable = false; because in this solution the line breaks (not visible) are also stored in the text field....
procedure EditText(Editable: Boolean)
var
NCEXTextEditorMgt: Codeunit "NCEX Text Editor Mgt.";
TempText: Text;
begin
TempText := Text;
if not NCEXTextEditorMgt.EditText(TempText, 0, MaxStrLen(Text), not Editable) then
exit;
Text := CopyStr(TempText, 1, MaxStrLen(Text));
end;
...
Page
...
field("Text"; Rec."Text")
{
ApplicationArea = All;
ToolTip = 'Specifies the text. Click on the field to edit the text.', Comment = 'DEU="Gibt den Text an. Klicken Sie auf das Feld, um den Text zu bearbeiten."';
Editable = false;
AssistEdit = true;
trigger OnAssistEdit()
begin
Rec.EditText(CurrPage.Editable());
CurrPage.Update();
end;
}
...
procedure EditText(RecordRef: RecordRef; TextFieldNo: Integer; var TempBlob: Codeunit "Temp Blob"; ReadOnly: Boolean) TextModified: Boolean
Important
Special care must be taken to ensure that the correct filters are set on the RecordRef.Note
The maximum number of characters per line (MaxLineStrLen) is determined by the length of the TextFieldNo field in this call. The text is automatically wrapped when entered in the editor if the length is exceeded. The wrap tries to leave words whole.pageextension 50000 "NVX Extended Text Lines" extends "Extended Text Lines"
{
actions
{
addfirst(Processing)
{
action(NVXTextEditorAction)
{
ApplicationArea = All;
Caption = 'Text Editor', Comment = 'DEU="Texteditor"';
Image = Edit;
ToolTip = 'Edit the text in the text editor.', Comment = 'DEU="Bearbeiten Sie den Text im Texteditor."';
trigger OnAction()
var
ExtendedTextLine: Record "Extended Text Line";
NCEXTextEditorMgt: Codeunit "NCEX Text Editor Mgt.";
TempBlob: Codeunit "Temp Blob";
RecordRef: RecordRef;
InStream: InStream;
NextLineNo: Integer;
TempText: Text;
begin
Clear(ExtendedTextLine);
ExtendedTextLine.SetRange("Table Name", Rec."Table Name");
ExtendedTextLine.SetRange("No.", Rec."No.");
ExtendedTextLine.SetRange("Language Code", Rec."Language Code");
ExtendedTextLine.SetRange("Text No.", Rec."Text No.");
RecordRef.GetTable(ExtendedTextLine);
if not NCEXTextEditorMgt.EditText(RecordRef, ExtendedTextLine.FieldNo(Text), TempBlob, not CurrPage.Editable()) then
exit;
ExtendedTextLine.LockTable();
ExtendedTextLine.DeleteAll();
NextLineNo := 10000;
TempBlob.CreateInStream(InStream);
while (not InStream.EOS()) do begin
Clear(ExtendedTextLine);
ExtendedTextLine."Table Name" := Rec."Table Name";
ExtendedTextLine."No." := Rec."No.";
ExtendedTextLine."Language Code" := Rec."Language Code";
ExtendedTextLine."Text No." := Rec."Text No.";
ExtendedTextLine."Line No." := NextLineNo;
NextLineNo += 10000;
InStream.ReadText(TempText);
ExtendedTextLine.Text := CopyStr(TempText, 1, MaxStrLen(ExtendedTextLine.Text));
ExtendedTextLine.Insert();
end;
end;
}
}
}
}
procedure EditText(var TempBlob: Codeunit "Temp Blob"; MaxLineStrLen: Integer; MaxTextLen: Integer; ReadOnly: Boolean) TextModified: Boolean
...
field(50000; "Text Preview"; Text[250])
{
DataClassification = CustomerContent;
Caption = 'Text Preview', Comment = 'DEU="Textvorschau"';
}
field(50001; "Text Storage"; Blob)
{
DataClassification = CustomerContent;
Caption = 'Text Storage', Comment = 'DEU="Textspeicher"';
}
procedure EditText(Editable: Boolean)
var
NCEXTextEditorMgt: Codeunit "NCEX Text Editor Mgt.";
TempBlob: Codeunit "Temp Blob";
InStream: InStream;
OutStream: OutStream;
NewText: Text;
begin
CalcFields("Text Storage");
"Text Storage".CreateInStream(InStream);
TempBlob.CreateOutStream(OutStream);
CopyStream(OutStream, InStream);
if not NCEXTextEditorMgt.EditText(TempBlob, 0, 0, not Editable) then
exit;
TempBlob.CreateInStream(InStream);
InStream.Read(NewText);
SaveText(NewText);
end;
procedure SaveText(NewText: Text)
var
OutStream: OutStream;
begin
"Text Storage".CreateOutStream(OutStream);
OutStream.Write(NewText);
"Text Preview" := CopyStr(NewText, 1, MaxStrLen("Text Preview"));
end;
...
Page
...
field("Text Preview"; Rec."Text Preview")
{
ApplicationArea = All;
ToolTip = 'Specifies the text. Click on the field to edit the text.', Comment = 'DEU="Gibt den Text an. Klicken Sie auf das Feld, um den Text zu bearbeiten."';
Editable = false;
AssistEdit = true;
trigger OnAssistEdit()
begin
Rec.EditText(CurrPage.Editable());
CurrPage.Update();
end;
}
...
Finmatics Autonomous Accounting Interface for AI-driven document processing tool by Finmatics. More information AppSource |