473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Using interop.word to search the content

3
Hi...

I am new to VB.net. Curretly i working with my final year project. Nw i need to read and find the content from the doc file. I have to read the whole content of the doc file.And will start to find the content from the references below.

Example:

References:

[1] L. Bernstein, “Get The Design Right”. IEEE Software, Vol. 10 No. 5, September 1993, pp. 61-63.

[2] Z. Razak, “The Internet Global Villages”, in Using IT to Build a Better Future Conference, Kuala Lumpur, 3 October 1995.


i need to get content within quotes “ ” from the references which is the title. Is there any solution to read and search all the "title" from doc??? Please help me.Thanks.
Aug 31 '07 #1
4 1985
SammyB
807 Expert 512MB
You would need to first search for "References:" to find the References part of the document, put all of that text into a string variable and then split it on double-quotes, then your titles would be every-other entry in the split array.
Sep 1 '07 #2
sjkwek
3
Ya. Thanks for replying. But how to gonna to get the title between " ". Can u guide me more. I nw still struggle with the coding. I using the word.Range, it can compile without an error, but it load very slow and can not get the result.

Dim objWord As New Word.Application
Dim objDoc As Word.Document
Dim objRange As Word.Range
Dim intPosition As Integer
Const wdTurquoise = 3
Const wdNoHighlight = 0
Const wdBlue = 2

objWord = CreateObject("Word.Application")
objWord.Visible = True

objDoc = objWord.Documents.Open("C:\Inetpub\wwwroot\Thesis1 \Doc\test.doc")
objRange = objDoc.Range

objRange.Find.Highlight = True
objRange.Find.Forward = True

Do While objRange.Find.Execute
If objRange.Text = "References" Then
objRange.Font.Size = 15
End If
intPosition = objRange.End
objRange.Start = intPosition
Loop


Thanks.

[Added by Sam from a PM: (please always reply in the thread)]
Thanks.For the reply. Oo..not really understand with it. How you gona to read the thing from the file,using interop.word class library or stream reader? Please guide me more by providing source code.Reali appreciate if you can help me.Thanks//
Sep 8 '07 #3
SammyB
807 Expert 512MB
...Thanks.For the reply. Oo..not really understand with it. How you gona to read the thing from the file,using interop.word class library or stream reader? Please guide me more by providing source code.Reali appreciate if you can help me.Thanks//
I'm confused. From your original posts, it looked like you were using VB6 or VBA, but you mention interop.word above. Are you using VB.NET? Have you downloaded the Interop stuff from Microsoft and worked through their Word examples, http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx?
Sep 19 '07 #4
sjkwek
3
Nice to hear from you again.Thanks again. Now i getting stress. Yup.I am using vb.net. But facing a problem.So sad. I cant set a new range for the found senteces. Below is the example of the code


Dim count As Integer
count = 0
Dim StartRange As Word.Range
Dim v_strKeyword As String = "References"
Dim b As String
For Each myWord In myWordDoc.Sentences
With myWord.Find
.ClearFormatting()
.Text = v_strKeyword
If .Execute = True Then
StartRange = myWord
Exit For
End If
End With
Next
'Get all the text from the below References into string
myWord = myWordDoc.Range(CType(myWordDoc.Sentences(StartRan ge.Sentences.Count).Start, System.Object), CType(myWordDoc.Sentences(myWordDoc.Sentences.Coun t).End, System.Object))
Me.txtContent.Text = myWord.Text
myWord = Nothing
myWordDoc.Close() 'close the word doc
myWordApp.Quit() 'Quit the word app
Sorry to disturb u again. thanks alot.









I'm confused. From your original posts, it looked like you were using VB6 or VBA, but you mention interop.word above. Are you using VB.NET? Have you downloaded the Interop stuff from Microsoft and worked through their Word examples, http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx?
Sep 21 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Chris | last post by:
Hi, everything works apart from the last line :-(( rng.Value2.ToString() An exception is thrown : "Old format or invalid type library" It gets compiled though (so he recognizes the property...
11
by: Dorsa | last post by:
HI, Could you please tell me the error in here. I am trying to open an XML file from a link. Response.Clear() Response.Expires = 0 Response.BufferOutput = False Response.ContentType =...
0
by: Zeljko | last post by:
VB.net 2005 express - Office Word 2003 Office 11 library =references I need to make from VB.net search in Word for these words: "tree", "bus", "car"...(complete list contains ca. 50 words) when...
1
by: amiparna | last post by:
There is two frame in my form.In d first frame there is a text box,and i give some word in the text box.I want to search the word from a file from the location(http://45.12.09.31...........) and if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.