Hallo,
ich möchte unterbinden, dass man zu große Screenshots in Dokumente einfügt.
z.B. max 800 x 600 Pixel
Wie komme ich an die Größe ran?
Der erster Versuch scheitert irgendwie bzw. liefert nur Schrott:
Function fEmbeddedObjects (doc As NotesDocument)
'Dim doc As NotesDocument
Dim rtitem As Variant
'...set value of doc...
'LE Check
If doc.HasEmbedded Then
Print "Doc contains an object, link, or attachment"
Else
Print "Doc has no objects, links, or attachments"
End If
'LE List
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) And IsArray(rtitem.EmbeddedObjects) Then
ForAll o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
Print "Anhang entdeckt..."
ElseIf ( o.Type = EMBED_OBJECT ) Then
Print "Eingebettetes Bild o.ä. entdeckt..."
ElseIf ( o.Type = EMBED_OBJECTLINK ) Then
Print "Link entdeckt..."
End If
End ForAll
Else
Print "Nur reiner Text entdeckt"
End If
End Function
Gruß
Leo
1
set item = doc.getFirstItem("Body")
do until item is nothing
item.remove
set item = doc.getFirstItem("Body")
i = i + 1
loop
Das Item ist dann natürlich weg, also besser auf einer Kopie machen. Aber wie Peter schon schrieb, ist es völlig normal, wenn es mehrere Body-Items gibt.
2.
Über Notes-Bordmittel (enbeddedobjects etc) kommst du nicht an den Screenshot ran, nur über Umwege wie DXL.
Ggf. hilft dir doc.length weiter. (Wobei man aus der Größe nicht auf die Auflösung schließen kann)
Der einzig saubere Weg wäre m.E. über DXL (oder C-API) auf den Richtext zuzugreifen und daraus die Bild-Abmessungen zu ermitteln.
Gruß
Roland
Nochmals Danke!
Woran könnte es liegen, dass das BODY-Feld mit großen Screenshots beim Speichern des Dokuments gelöscht wird?
Hier z.B. wird eine Mail mit einem bestimmten Text und dem Inhalt des Doks-Body verschickt, dann wird der Text in ein anderes Feld des Doks eingetragen und das Dok wird gespeichert:
'RT-Body holen
Dim rtitemB As NotesRichTextItem
Set rtitemB = doc.GetFirstItem("Body")
.....
Call uidoc.Save
Gruß
Leo
Ein Richtextitem definiert man IMMER als Richtextitem... Warum sollte man hier Variant wählen?
Na ja...
Hier z.B. ein Beispiel, das allerdings bei mir falsche Ergebnisse liefert:
This script counts the number of embedded objects, object links, and file attachments in the
Body item of a document, and prints the results in the status bar. For example, the script
prints "3 attachments 2 links 4 objects."
Dim doc As NotesDocument
Dim rtitem As Variant
Dim attachCount As Integer
Dim linkCount As Integer
Dim objectCount As Integer
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
attachCount = 0
linkCount = 0
objectCount = 0
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
Select Case o.Type
Case EMBED_ATTACHMENT:
attachCount = attachCount + 1
Case EMBED_OBJECTLINK:
linkCount = linkCount + 1
Case EMBED_OBJECT:
objectCount = objectCount + 1
End Select
End Forall
End If
Print( attachCount & " attachments " & linkCount & _
" links " & objectCount & " objects " )
das macht man (ich) normal so:
This script counts the number of embedded objects, object links, and file attachments in the
Body item of a document, and prints the results in the status bar. For example, the script
prints "3 attachments 2 links 4 objects."
Dim doc As NotesDocument
Dim item as NotesItem
Dim rtitem As NotesRichtextItem
Dim attachCount As Integer
Dim linkCount As Integer
Dim objectCount As Integer
'...set value of doc...
Set item = doc.GetFirstItem( "Body" )
attachCount = 0
linkCount = 0
objectCount = 0
If not item is nothing then ' test if item exists!
If ( item.Type = RICHTEXT ) Then
set rtItem = item ' if item is type of richtext.
Forall o In rtitem.EmbeddedObjects
Select Case o.Type
Case EMBED_ATTACHMENT:
attachCount = attachCount + 1
Case EMBED_OBJECTLINK:
linkCount = linkCount + 1
Case EMBED_OBJECT:
objectCount = objectCount + 1
End Select
End Forall
End If
End If
Print( attachCount & " attachments " & linkCount & _
" links " & objectCount & " objects " )