Help Please

  • Thread starter John Patrick Wesler
  • Start date
J

John Patrick Wesler

Dear Reader

I am trying to help my teacher write reports. The reports are done in
Microsoft Word in a table, eg.

FOUR THREE TWO ONE
Maths x
English x

so I have written a java programme that asks for the marks then saves a
reult in a .txt or .doc file eg.

Maths: 4
English: 3

I want to try and reference it in some way that Word takes the "4" from
"Maths" and places a tick in the respective table. I don't quite know if that
is possible, any help would be greatly appreciated.

Regards John
 
D

Doug Robbins - Word MVP

For the document are you starting with a empty document or one with the

FOUR THREE TWO ONE
Maths
English

already set up in it in a table, the cells of which you want populated with
an x in the appropriate column, or does this layout have to be created on
the fly?

How many documents are to be created at the one go? Is there some other
information in the "data source" that must also be included in the document?
If more than one document is to be created at at time, what separates the
data for each document in the data source?


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

John Patrick Wesler

Doug Robbins - Word MVP said:
For the document are you starting with a empty document or one with the

FOUR THREE TWO ONE
Maths
English

already set up in it in a table, the cells of which you want populated with
an x in the appropriate column, or does this layout have to be created on
the fly?

How many documents are to be created at the one go? Is there some other
information in the "data source" that must also be included in the document?
If more than one document is to be created at at time, what separates the
data for each document in the data source?


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

-The table ias already there and i just want to populate it with "x"
-There is no other information.
-I need Word to Read "Maths: 4" and decide to put an "x" into the "FOUR"
column of the "Maths" row. I don't know if I've quite explained it properly
but it's really simple, if you just give the simplified code i could play
around with it to get exactly what I want.

-Thank You
 
D

Doug Robbins - Word MVP

The following code should do it:

Dim Source As Document
Dim Target As Document
Dim tblTarget As Table
Dim i As Long
Dim Score As Range
'Start with the document containing the table as the active document
Set Target = ActiveDocument
Set tblTarget = Target.Tables(1)
'Open the document created by your Java program
Set Source = Documents.Open("Path\Filename")
With Source
For i = 1 To .Paragraphs.Count
Set Score = .Paragraphs(i).Range
Score.End = Score.End - 1
Score.Start = Score.End - 1
tblTarget.Cell(i + 1, 6 - Score.Text).Range.Text = "x"
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top