From 27e9c099e5968da868b5fa9d7e153bde36d7756e Mon Sep 17 00:00:00 2001 From: Roland Lannuzel Date: Tue, 2 Jul 2024 16:53:57 +0200 Subject: [PATCH] wp classe (POC) --- Project/Sources/Classes/WPdocument.4dm | 24 +++++++++++++++++++++++ Project/Sources/Classes/WPsection.4dm | 16 +++++++++++++++ Project/Sources/Methods/z.4dm | 27 +++++++++++++++++++++++++- Project/Sources/catalog.4DCatalog | 2 +- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 Project/Sources/Classes/WPdocument.4dm create mode 100644 Project/Sources/Classes/WPsection.4dm diff --git a/Project/Sources/Classes/WPdocument.4dm b/Project/Sources/Classes/WPdocument.4dm new file mode 100644 index 00000000..e967e9bc --- /dev/null +++ b/Project/Sources/Classes/WPdocument.4dm @@ -0,0 +1,24 @@ +Class constructor() + This:C1470.document:=WP New:C1317 + + +Function setText($newText : Text; $textPosition : Integer; $rangeUpdate : Integer) + If (Count parameters:C259<3) + $rangeUpdate:=wk include in range:K81:180 + End if + WP SET TEXT:C1574(This:C1470.document; $newText; $textPosition; $rangeUpdate) + +Function getText($expressions : Integer)->$text : Text + If (Count parameters:C259=0) + $expressions:=wk expressions as value:K81:255 + End if + $text:=WP Get text:C1575(This:C1470.document; $expressions) + +Function textRange($start : Integer; $end : Integer)->$range : Object + $range:=WP Text range:C1341(This:C1470.document; $start; $end) + + + + + + \ No newline at end of file diff --git a/Project/Sources/Classes/WPsection.4dm b/Project/Sources/Classes/WPsection.4dm new file mode 100644 index 00000000..5df76976 --- /dev/null +++ b/Project/Sources/Classes/WPsection.4dm @@ -0,0 +1,16 @@ +Class constructor($target : Object; $index : Integer) + + Case of + : (Count parameters:C259=2) + This:C1470.section:=WP Get section:C1581($target; $index) // document + index + + : (Value type:C1509($target)=Is object:K8:27) + This:C1470.section:=WP Get section:C1581($target) //element + End case + + +Function newHeader()->$header : Object + $header:=WP New header:C1586(This:C1470.section) + +Function newFooter($section : Object)->$footer : Object + $footer:=WP New footer:C1587(This:C1470.section) \ No newline at end of file diff --git a/Project/Sources/Methods/z.4dm b/Project/Sources/Methods/z.4dm index edeb0af7..c006de69 100644 --- a/Project/Sources/Methods/z.4dm +++ b/Project/Sources/Methods/z.4dm @@ -1,3 +1,28 @@ //%attributes = {} //$d:=Chaîne(Date du jour; Système date court) -//$h:=Chaîne(Heure courante; Système heure court) \ No newline at end of file +//$h:=Chaîne(Heure courante; Système heure court) + + +var $doc : cs:C1710.WPdocument +var $section1a; $section1b : cs:C1710.WPsection + +var $text : Text +var $range; $header; $footer : Object + +$doc:=cs:C1710.WPdocument.new() + +$doc.setText("blablabla"; wk append:K81:179) + +$text:=$doc.getText() +$range:=$doc.textRange(1; 3) + +$section1a:=cs:C1710.WPsection.new($doc.document; 1) +$section1b:=cs:C1710.WPsection.new($range) + + +$header:=$section1b.newHeader() +$footer:=$section1b.newFooter() + + + + diff --git a/Project/Sources/catalog.4DCatalog b/Project/Sources/catalog.4DCatalog index bd21f13b..9757449c 100644 --- a/Project/Sources/catalog.4DCatalog +++ b/Project/Sources/catalog.4DCatalog @@ -14,7 +14,7 @@ - +