473,396 Members | 2,033 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,396 software developers and data experts.

Word Automation speed issue

i need to open a Word Document from sql server database, make updates to the
document, then save as READ-ONLY. Basically, this will be a view of the
document that user cannot change. updates to the document are done by
reading field data from the database into the document.

i can read the blob doc to file on local PC but i have noticed some speed
losses viewing the document READ-ONLY vs viewing without this condition.
please see code in question below. it seems like a waste of run time to have
to Save the Document, Close it, then Open it Read-Only but that's the only
way i know how unless someone else out there has a faster way. please
respond if so. thanks.
if ((bool) oReadOnly)

{
oDoc.SaveAs(ref oFilePath, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

oDoc.Close(ref oMissing, ref oMissing, ref oMissing);

oDoc = oWord.Documents.Open(ref oFilePath, ref oMissing, ref oReadOnly, ref
oMissing, ref oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing);

File.SetAttributes((string) oFilePath,System.IO.FileAttributes.ReadOnly);

}

else

{

oDoc.SaveAs(ref oFilePath, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

}
Nov 16 '05 #1
2 1693
This is what I understand...
1- get blob from db and create a file on local drive of type *.doc
2- update it
3- save local file back to db and mark it has readonly
4- do the step 1 again for view

if this is the condition then you do not have to get the file again from db,
you can mark (attrib) the local copy readonly while saving back to db. this
will avoid fetching for file again.
"Devhead" <de******@bellsouth.net> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
i need to open a Word Document from sql server database, make updates to
the document, then save as READ-ONLY. Basically, this will be a view of the
document that user cannot change. updates to the document are done by
reading field data from the database into the document.

i can read the blob doc to file on local PC but i have noticed some speed
losses viewing the document READ-ONLY vs viewing without this condition.
please see code in question below. it seems like a waste of run time to
have to Save the Document, Close it, then Open it Read-Only but that's the
only way i know how unless someone else out there has a faster way. please
respond if so. thanks.
if ((bool) oReadOnly)

{
oDoc.SaveAs(ref oFilePath, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

oDoc.Close(ref oMissing, ref oMissing, ref oMissing);

oDoc = oWord.Documents.Open(ref oFilePath, ref oMissing, ref oReadOnly,
ref oMissing, ref oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing);

File.SetAttributes((string) oFilePath,System.IO.FileAttributes.ReadOnly);

}

else

{

oDoc.SaveAs(ref oFilePath, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

}

Nov 16 '05 #2
hmmmm. it seems that would add more overhead in this case. thanks for the
response.

"Ashish Das" <yh****@hotmail.com> wrote in message
news:eu**************@TK2MSFTNGP11.phx.gbl...
This is what I understand...
1- get blob from db and create a file on local drive of type *.doc
2- update it
3- save local file back to db and mark it has readonly
4- do the step 1 again for view

if this is the condition then you do not have to get the file again from
db, you can mark (attrib) the local copy readonly while saving back to db.
this will avoid fetching for file again.
"Devhead" <de******@bellsouth.net> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
i need to open a Word Document from sql server database, make updates to
the document, then save as READ-ONLY. Basically, this will be a view of
the document that user cannot change. updates to the document are done by
reading field data from the database into the document.

i can read the blob doc to file on local PC but i have noticed some speed
losses viewing the document READ-ONLY vs viewing without this condition.
please see code in question below. it seems like a waste of run time to
have to Save the Document, Close it, then Open it Read-Only but that's
the only way i know how unless someone else out there has a faster way.
please respond if so. thanks.
if ((bool) oReadOnly)

{
oDoc.SaveAs(ref oFilePath, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

oDoc.Close(ref oMissing, ref oMissing, ref oMissing);

oDoc = oWord.Documents.Open(ref oFilePath, ref oMissing, ref oReadOnly,
ref oMissing, ref oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing);

File.SetAttributes((string) oFilePath,System.IO.FileAttributes.ReadOnly);

}

else

{

oDoc.SaveAs(ref oFilePath, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing,

ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

}


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike MacSween | last post by:
Office 2000 From Access I've been starting an instance of word and doing a mail merge. Everything hunky-dory until I applied SP1 yesterday. Now this: dim wrd as Object set wrd =...
3
by: Mike MacSween | last post by:
Office 2000 From Access I've been starting an instance of word and doing a mail merge. Everything hunky-dory until I applied SP1 yesterday. Now this: dim wrd as Object set wrd =...
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
10
by: cj2 | last post by:
I open a word template in VB and add values to the bookmarks then save the document as as pdf. When I then go to close the document it pops up a save as dialog box. It's already saved the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.