Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Need to save my file with readonly recommended.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
steveo  
View profile  
 More options Feb 2, 12:43 pm
From: steveo <ste...@syslang.net>
Date: Thu, 2 Feb 2012 09:43:50 -0800 (PST)
Local: Thurs, Feb 2 2012 12:43 pm
Subject: Need to save my file with readonly recommended.
This is getting critical for us. We have files that need to be saved
with readonly recommended. The manual approach is to say:

File -> SaveAs -> Tools -> General -> Then check the ReadOnly
Recommended box.

I'm not the guy coding this up but I'm ok with python. I need to
either know how to create a new file that has this setting, or how to
copy from a blank file that has this setting that I can then write to.

Does this make sense?

Help would be greatly appreciated.

TIA

Steve Orr


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Machin  
View profile  
 More options Feb 5, 1:57 am
From: John Machin <sjmac...@lexicon.net>
Date: Sat, 4 Feb 2012 22:57:20 -0800 (PST)
Local: Sun, Feb 5 2012 1:57 am
Subject: Re: Need to save my file with readonly recommended.

On Friday, February 3, 2012 4:43:50 AM UTC+11, steveo wrote:

> This is getting critical for us. We have files that need to be saved
> with readonly recommended. The manual approach is to say:

> File -> SaveAs -> Tools -> General -> Then check the ReadOnly
> Recommended box.

> I'm not the guy coding this up but I'm ok with python. I need to
> either know how to create a new file that has this setting, or how to
> copy from a blank file that has this setting that I can then write to.

If you are driving Excel yourself e.g with pywin32 COM,  then you should
find that there is a ReadOnlyRecommended optional arg on the workbook
SaveAs method.

If you are using xlwt:

option 1: There's a release being made real soon now. After the release
I'll add not only the read_only_recommended caper but also the
write_reservation password and user_name caper -- this latter prompts the
user for a password if they want to open the workbook in modify mode; the
idea is that the file creator hands out the password only to trusted users.
Seems a much better idea to me. The two capers use the same record
(FILESHARING) in the xls file so it's better to do both at once.

option 2: You get your boss to donate some brass to buy tranquilisers for
the folk who want a release real soon, and I'll do it in the current
release.

option 3: You do a gross hack on Workbook.py:

between these two lines:

        before += self.__write_access_rec()
        before += self.__codepage_rec()

insert the following:

        before += struct.pack('<5H', 0x005B, 6, getattr(self,
'read_only_recommended', 0), 0, 0) # untested

Then you can use it like this:

wb = xlwt.Workbook()
...
wb.read_only_recommended = True
...
wb.save('foo.xls')

HTH,
John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Machin  
View profile  
 More options Feb 5, 4:03 am
From: John Machin <sjmac...@lexicon.net>
Date: Sun, 5 Feb 2012 01:03:15 -0800 (PST)
Local: Sun, Feb 5 2012 4:03 am
Subject: Re: Need to save my file with readonly recommended.

 # tested:

        if getattr(self, 'read_only_recommended', 0):
            import struct
            before += struct.pack('<5H', 0x005B, 6, 1, 0, 0)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven W. Orr  
View profile  
 More options Feb 14, 3:40 pm
From: "Steven W. Orr" <ste...@syslang.net>
Date: Tue, 14 Feb 2012 15:40:27 -0500
Local: Tues, Feb 14 2012 3:40 pm
Subject: Re: [pyxl] Re: Need to save my file with readonly recommended.
On 2/5/2012 4:03 AM, John Machin wrote:

I just wanted to thank you for the patch. I ramrodded it to the people who
needed it, it was applied to the code and used by the application. It worked
first time. Looking forward to the next release where it will be incorporated.

Isn't the internet great?

:-)

--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Machin  
View profile  
 More options Feb 14, 4:37 pm
From: John Machin <sjmac...@lexicon.net>
Date: Tue, 14 Feb 2012 13:37:04 -0800 (PST)
Local: Tues, Feb 14 2012 4:37 pm
Subject: Re: [pyxl] Re: Need to save my file with readonly recommended.

It wasn't a patch; it was a gross hack. It won't be incorporated. Instead
there will be a principled enhancement, which will include the write
protection password facility.

Cheers,
John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »