[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

PROTECT OOCALC BEING CHANGED

Posted on 2011-04-23
7
Medium Priority
?
347 Views
Last Modified: 2012-05-11
Hi All,

I print report to OOCalc.

I want to protect its file from being changed manually by user.

How could I do it ?

Thank you.
0
Comment
Question by:emi_sastra
  • 3
  • 3
7 Comments
 
LVL 25

Expert Comment

by:SStory
ID: 35516907
Print it as a PDF
0
 
LVL 25

Expert Comment

by:SStory
ID: 35516915
Or set a password on the document. Or change user permissions for that document to read only from the operating system.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 35517979
Hi All,

I still want to use (print) oocalc and I have no idea how to protect it using code after I finish printing it.

Thank you.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 2000 total points
ID: 35710655
emi_sastra,

Here is some sample .net code that will create a calc document and save it in a protected status.

-Bear
' Create your Calc Document
        Dim objServiceManager As Object = CreateObject("com.sun.star.ServiceManager")
        Dim objOODesktop As Object = objServiceManager.createInstance("com.sun.star.frame.Desktop")
        Dim arg(-1) As Object
        Dim objCalc As Object = objOODesktop.LoadComponentFromUrl("private:factory/scalc", "_blank", 0, arg)
        Dim objSheet As Object = objCalc.Sheets.getByIndex(0)

        ' Put Data in a Cell
        Dim oCell As Object = objSheet.getCellRangeByName("A1")
        oCell.setString("This is my Data")

        ' First you have to protect the sheet with a password
        objSheet.Protect("testpass")
        ' Now Protect the Document with a password
        objCalc.Protect("testpass")

        ' Save the File
        objCalc.storetoURL("file:///C:/vb_ooo_test.ods", arg)
        objCalc.Close(False)

Open in new window

0
 
LVL 25

Expert Comment

by:SStory
ID: 35711986
That is a great post about setting the password and it would be protected even if you email it.

If you just need to protect it locally--on your network in a certain folder, another way would be to change the file's permission so that other users only have read and execute privileges on that file:

http://msdn.microsoft.com/en-us/magazine/cc163832.aspx

Of course if it is a spreadsheet and  you want to protect part from changes and the rest be changeable then the above is better by far.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 35717022
Hi Bear,

It works.

Thank you very much for your help.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 35717025
Hi SStory,

Thank you for your link.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question