If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Protect Excel Sheet, while opening from .asp .

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-16-04, 16:02
vsshah vsshah is offline
Registered User
 
Join Date: Oct 2002
Posts: 48
Protect Excel Sheet, while opening from .asp .

Hi,

I am generating Excel Report output using .asp.

I am opening one existing .xls template. I am inserting data and picture in to cells. At last, I am using 'Saveas' other name.

So, all content of .xls sheet will be stored under new .xls file name. Now, I am showing this new .xls filereport in another window of .asp.

But this .xls file under browser is not protected. One can delete content or copy content(picture of signature).

So, I want to do one of this things.
1. Protect .xls sheet for delete/copy content of any cell in it.
2. I want to stop 'Right click event' and 'certain menu option' in excel sheet opened in new Window.
3. I want to open .xls in window in such a mode so, user can not copy any content from it.


I have done following ton create .xls file report. I used VB script and JavaScript also.
------------
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Application.Visible = True

' Close all pending books
ExcelApp.Workbooks.Close

'Open the template
Set ExcelBook = ExcelApp.Workbooks.Open("C:\Inetpub\iissamples\te\ TE_Supplement_Template.XLS", , True)
lsFullFileName = "C:\Inetpub\iissamples\te\TE_Supplement_Template2. XLS"

Set oFS = CreateObject("Scripting.FileSystemObject")
if (oFs.FileExists(lsFullFileName) = TRUE) then
oFS.DeleteFile(lsFullFileName)
End if

''''''assiging data stuff to cells.

ExcelBook.SaveAs lsFullFileName

ExcelApp.WorkBooks.Close

ExcelApp.Application.Quit
Set ExcelApp = Nothing
----------

I have used following to open this file from Java script.

====
window.open('c:/inetpub/iissamples/te/TE_supplement_template2.xls','CapitalExpenditure', 'menubar=yes,scrollbars=yes,resizable=yes,width=80 0,height=500')
====

Thanks in advance.....
Reply With Quote
  #2 (permalink)  
Old 02-16-04, 20:07
Xl-Dennis Xl-Dennis is offline
Registered User
 
Join Date: Dec 2003
Location: Östersund Sweden
Posts: 60
Hi,

Quote:
3. I want to open .xls in window in such a mode so, user can not copy any content from it
I don't see how this can be achieved. We can protect the contents but preventing from copying it it's a difficult task to achieve. AS You know there exist many ways to to a copy-command in XL...

Have You considered to take a picture and view it for end-users?

Kind regards,
Dennis
__________________
Kind regards,
Dennis
Reply With Quote
  #3 (permalink)  
Old 02-16-04, 21:20
vsshah vsshah is offline
Registered User
 
Join Date: Oct 2002
Posts: 48
I can go for picture(snap shot) also.

Thanks Dennis.

My problem is, I dont want any user to copy electronic signature from .xls file/report. That can be achieved if RightClick not work in .xls sheet opening window/browser OR the menu shows at top has 'Copy' facility removed OR Protect .xls with some passowrd(dynamically).

Is there any way, I can convert .xls file in to some snap shot(.snp) OR any graphical form ??? So, reader/user can not copy 'signature file' from it.

Thanks...

Last edited by vsshah; 02-16-04 at 21:22.
Reply With Quote
  #4 (permalink)  
Old 02-17-04, 11:17
vsshah vsshah is offline
Registered User
 
Join Date: Oct 2002
Posts: 48
Got solution...

I used following way.

ExcelBook.Sheets(1).Protect DrawingObjects=False, Contents=False, Scenarios=False, Password="Chicago"

and it works. My .xls sheet is protected. But, if I want to unprotect using 'chicago' password. It is not. But, I am okay as long as .xls sheet gets protected.

So, my corrected code is as below in .asp.

------------
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Application.Visible = True

' Close all pending books
ExcelApp.Workbooks.Close

'Open the template
Set ExcelBook = ExcelApp.Workbooks.Open("C:\Inetpub\iissamples\te\ TE_Supplement_Template.XLS", , True)

lsFullFileName = "C:\Inetpub\iissamples\te\TE_Supplement_Template2. XLS"

Set oFS = CreateObject("Scripting.FileSystemObject")
if (oFs.FileExists(lsFullFileName) = TRUE) then
oFS.DeleteFile(lsFullFileName)
End if

''''''assiging data stuff to cells.

ExcelBook.Sheets(1).Protect DrawingObjects=False, Contents=False, Scenarios=False, Password="Chicago"

ExcelBook.SaveAs lsFullFileName

ExcelApp.WorkBooks.Close

ExcelApp.Application.Quit
Set ExcelApp = Nothing

------------
Reply With Quote
  #5 (permalink)  
Old 02-17-04, 20:12
Xl-Dennis Xl-Dennis is offline
Registered User
 
Join Date: Dec 2003
Location: Östersund Sweden
Posts: 60
Thumbs up

Hi,

Thanks for the feedback and code

Kind regards,
Dennis
__________________
Kind regards,
Dennis
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On