Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Prevent editing in Web Browser
Message
De
22/12/2008 12:27:33
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
À
22/12/2008 11:39:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01368880
Message ID:
01369201
Vues:
13
>>>>I've got a comma separated values file (csv) that opens in a webBrowser control hosted in a VFP9 form. It appears rendered as a spreadsheet (Excel) and is editable.
>>>>
>>>>How can I prevent the contents from being changed?
>>>>
>>>>I've tried to set the file as readonly, but, it does not help; the user can still edit the content.
>>>>
>>>>TIA
>>>>Mike
>>>
>>>
#define xlNoSelection                                     -4142
>>>
>>>oXLS = myWBControl.Object.Document
>>>oExcel = oXLS.Application
>>>oExcel.CommandBars("Standard").visible = .F.
>>>oExcel.CommandBars("Formatting").visible = .F.
>>>oExcel.ActiveWorkbook.ActiveSheet.EnableSelection = xlNoSelection
>>>oExcel.ActiveWorkbook.ActiveSheet.Protect(,,.T.,,.T.)
Cetin
>>
>>Hi Cetin,
>>
>>Thanks for the reply.
>>
>>After I've called the browser's navigate2("file://somepath/some_csv_file.csv") method I've added your code suggestion by modifying "myWBControl" to my object name, When I run the code I receive a Program Error - "OLE error code 0x80020006: Unknown name." when the line containing oXLS.Application tires to execute. From the VFP debugger, I can see that the object oXLS does not have this method. Did I not do this correctly?
>>
>>Mike
>
>If it doesn't then it is not opening with excel really. You may instead navigate to an xls file (an empty dummy one maybe) and then open the csv as a workbook.
>
>PS: Why don't you get that csv into a cursor and browse that one in a grid instead of a web browser control.
>Cetin

I tried to open an existing XLS file and it appears in the browser in exactly the same way as the CSV. Your suggested code also errors with the same message on the oXLS.Application command. To make matters more "interesting", if I specify a Word file (DOC), it opens in the browser with the "Reviewing" toolbar docked at the top with the ability to right-click and open even more toolbars. The CSV and XLS files do not display this behaviour (i.e., no toolbars are present or available).

If I try your suggested code on the Word document, it too errors with the same message.

Thanks for trying to assist.

Mike
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform