word working with sql report service 2008

J

jazzydance

I would like to export a sql server report service 2008 report with about
10 sub or linked reports to a Word so that I can generate a table of
contents. From looking on the web sites it looks like my best option is to
use word.
Can you tell me how would you accomplish this task using Word 2003 or Word
2007?
 
P

Peter Jamieson

I can't say I know a great deal about the possibilities in this area
(perhaps you would get better info. in a Reporting Services group), but
a. Word can generate a ToC based on paragraph styles, or on { TC } fields
b. AFAICS the Reporting Services reports don't let you specify
anything that would result in a particular Word paragraph style being
applied when you export in .doc format, or which would result in a Word
field being generated. (Although you can use HTML tagging in RS layouts,
I'm not sure you can get that to translate into Word styles either)
c. So without 3rd party software, the simplest approach is probably:
1 format the paragraphs that you want to appear in the ToC with
unique formatting
2 Once the document is in Word, use Find/Replace to search for that
unique formatting and modify the paragraph format
3 Add a TOC field to the document, or keep one in a standard
document that includes the generated report .doc

If you just need to process one such report, it's probably simplest to
do that by hand. If it's a regular task, you'd need to automate Word,
and then you'd have to consider whether you had a completely automated
process sitting on a server (not a recommended option for Word), etc.

AFAICS RS can currently only "save as" .doc format. If it is capable of
doing .docx format then you would also have the option of modifying the
document using a .NET language without having to involve Word at all.

Peter Jamieson

http://tips.pjmsn.me.uk
 
J

jazzydance

"Peter Jamieson":

This will be a process that we do every month. I will generate the sql
server report service reports 2008 and export the reports to word 2003 or
word 2007.
I have the following additional questions to ask you:

1. You mentioned automate 'word' in your previous e-mail message. Can you
explain what you mean by automate.

2. Also I was thinking that I could embed some of the of the word features
in the sql report report servcie xml to create an automatic table of contents
in word.
If you look at the links:

http://office.microsoft.com/training/training.aspx?AssetID=RC102616991033

http://office.microsoft.com/en-us/word/hp012253721033.aspx,

it seems like I could possibly have an automatic TOC generated by embedding
some of the TOC statements.

Do you think this is a possibility?
 
P

Peter Jamieson

2. Also I was thinking that I could embed some of the of the word
features
in the sql report report servcie xml to create an automatic table of contents
in word.
If you look at the links:

The basic problem is that the built-in facility in SSRS only lets you
generate Word format reports as .doc format, and .doc is not XML-based.
So the rendering component that generates .doc format would have to
understand the WordProcessingML/WordML that you inserted and be able to
convert it into the corresponding features in the .doc binary format
(e.g. insert a { ToC } field that would then generate a ToC) in Word. I
don't know as an absolute certainty but I would be very surprised if the
..doc rendering component can do that.

AFAIK Microsoft has not yet produced a rendering extension to output
..docx (curious, given their commitment to the new format, but perhaps
they are leaving such things to third parties - there is for example the
pay-for product by Aspose (see

http://www.aspose.com/categories/ss...ose.words-for-reporting-services/default.aspx

) and there may well be others. However, even then, I can't tell you
whether or not you can insert WordProcessing ML that the Aspose
extension would pass through into your .docx. That's one reason why
you'd be better off asking in an SRSS-specific group.
1. You mentioned automate 'word' in your previous e-mail message. Can you
explain what you mean by automate.

The Word application is an object that can be programmed using "COM
Automation". Maybe the idea that you can "script" Word might be more
familiar to you? In any case, the idea is that you can start a copy of
Word, get it to open or create a document, get it to insert text, and in
fact do the vast majority of things that a user could do using Word's
user interface. You can automate Word using any language/programming
system that knows how to work with COM automation (e.g. VB or VBA),
including .NET languages such as C# and VB.NET. With .NET you can also
use the VSTO library (not really sure how to describe it) to control Word.


[The other way to create or modify Word documents is to do it directly
by generating the necessary XML files and a .docx container (basically a
ZIP file) to hold them. At present the Open XML SDK is probably the way
to go if you need to do that - see, e.g.:

http://msdn.microsoft.com/en-us/library/bb448854(office.14).aspx

http://msdn.microsoft.com/en-us/office/aa905545.aspx

If you don't have programing resource available that's probably quite an
expensive way to go.

The following is probably rather too much detail right now, but in
addition...when it comes to creating things such as Tables of Content,
it's worth bearing in mind that with a typical ToC that lists a page
number for each part of the document, /something/ has to be able to work
out which page a particular piece of content is actually on. Although
you could obviously generate your own ToC based on your knowledge of
where each item would be, it would be a "static" ToC. That might be
perfectly adequate for your needs, but such a ToC would not easily be
corrected if, for example, the user needed to reformat an A4 document
for printing on US Letter paper, or the user needed to make other
changes that would result in a repagination. In other words, inserting a
ToC field is probably still the most versatile way of generating a ToC,
but then at some point you're likely to have to ensure that Word
actually "updates" the ToC field, and that would typically require that
a user knew they had to do that, or require that you automated Word in
some way. i.e. the "direct generation" approach to constructing Word
documents does not necessarily do /everything/ you need.


Peter Jamieson

http://tips.pjmsn.me.uk
 

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