Solved

Extracting Text from a Notes Document.

Posted on 2007-11-26
11
466 Views
Last Modified: 2013-12-18
Greetings,

Is there some way to extract the text from a Notes Document in VB.Net.
I am trying to mimic the File->Export functionality of the Notes Client.

Thanks in advance.
0
Comment
Question by:sval1411
  • 6
  • 4
11 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 20355436
Depends what kind of text.

Rich Text is difficult to do correctly, straight text, no embedded pictures or attachments is not to hard.

It may be best to buy a third party add in that handles this if you plan to do it regularly.


I hope this helps !


0
 
LVL 31

Expert Comment

by:qwaletee
ID: 20355961
Do you want to mimic it by accessing the Notes export functions, or do you wish to go straight at the raw data yourself to do the extraction? If you are doing the raw data route, do you need just the text (unformatted) or do you need formatted text (tables, fonts, color, style, non-textual elements)?
0
 

Author Comment

by:sval1411
ID: 20358164
Greetings,

Thanks for the responses.

When you do a File->Export and Save it as ACII text, it only exports the text from the the document. Say it was an email document, then it would export, the following fields:

From (sender)
To
CC
BCC
Body
(I guess these are the fields that are present in the "Memo" form)

The Body is exported as raw text, I dont believe the format elements like tables, fonts, color, etc. are exported.

I am able to extract all the metadata associated with a document (including the hidden fields - fields that start with a "$"). But when you use the Notes File->Export functionality, Not all fields get exported - only the fields that are visible to the user when the document is opened in the Notes Client.

I am hoping to do this without using "SendKeys".

Thanks in advance. Appreciate all the time and effort.
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:sval1411
ID: 20366801
Greetings,

I found a work around to acheive "Text Extraction", but it does not completely mimic the File Export functionality of the Notes Client.

Here is what I have done:
1) Render the document to a Rich Text Item.
2) Attach that Rich Text Item to another, newly created document.
3) From the newly created Document - retrieve the text from that Rich Text Item.
4) Delete (Remove permanently) the newly created document.

Attached please find the code snippet.

'notesDoc = Document whose text needs to be extracted / exported
'"renderedDoc" = Name of the Rich Text Item that the above notesDoc is going to be rendered to
'newNotesDoc = temp notes document that shall store the "renderedDoc"
'notesRTItem = temp notes rich text item that shall extract the text from the item named "renderedDoc" in the newNotesDoc
 
 
newNotesDoc = notesDatabase.CreateDocument() 'creating temp notes doc
newNotesDoc.CreateRichTextItem("renderedDoc")'creating rtitem named "renderedDoc"
notesDoc.RenderToRTItem(newNotesDoc.GetFirstItem("renderedDoc")) 'rendering the notesDoc
 
notesRTItem = newNotesDoc.GetFirstItem("renderedDoc") 'extracting the text from the rtitem named "renderedDoc"
MessageBox.Show(notesRTItem.GetFormattedText(True, 0))
 
newNotesDoc.Remove(True)

Open in new window

0
 

Author Comment

by:sval1411
ID: 20366867
Only one question that I had was,

with the above code, I am able to successfully extract all the text. but the format of the text that is extracted is a little different from File->Export (ASCII text) functionality.
This might not be too much of an issue, but it would be great if I can have the same formatting as the File->Export functionality.

Any suggestions on this are more than welcome.
Thanks.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 20378362
just use:

Set body = notesDoc.getFirstItem("Body")
bodyText = body.getFormattedText(True,72)
    'or body.getUnformattedText(), or change 72 to a different wrap, or change True to False to leave any tab as-is

Open in new window

0
 

Author Comment

by:sval1411
ID: 20386131
Thanks, I used that it does extract the text successfully, but the formating is not the same as Notes->File Export.

This code does help though.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 20399810
It should be very, very close
0
 

Author Comment

by:sval1411
ID: 20404465
yes it is,
it does get all the necessary text form the doc.
Do you know how the File->Export functionality is implemented in Notes though??

Thanks again for all your help.
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 500 total points
ID: 20408952
The FIle->Export is in a DLL with a specific caller naming convention and specific file naming convention, which is then listed in NOTES.INI

There is no official way to call it from regular Notes programming or regular Notes interfaces.

If you want to understand how import/eexport works, you need to dowonload the Lotus Notes C API, and examine the documentation and exampels for import/export.
0
 

Author Closing Comment

by:sval1411
ID: 31411094
Thanks a lot. As always your comments and suggestions are most valuable.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question