Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


-------- Original Message  --------
From: rhubarbpieguy@gmail.com
To: Dave Barton <db@tasit.net>
Date: Sat, 21 Jul 2012 12:59:52 -0500

On 07/21/12 00:45, Dave Barton wrote:
-------- Original Message  --------
From: rhubarbpieguy@gmail.com
To: users@global.libreoffice.org
Date: Fri, 20 Jul 2012 20:33:27 -0500

On 07/20/12 02:16, Dave Barton wrote:
-------- Original Message  --------
From: rhubarbpieguy@gmail.com
To: users@global.libreoffice.org
Date: Thu, 19 Jul 2012 16:48:53 -0500

I'd like to create a macro for a user-defined date format
(H:MMa/p).  As
examples, 7:00 AM would display as 7:00a and 3:33 PM as 3:33p.  I can
create the format manually, but I understand the LibreOffice format
can't save user-defined formats.  So my thought is to create a macro
which creates the format each time the spreadsheet is opened.  The
user-defined Format Code is for a saved Style.

The macro records without incident and the date format is correct.
However, running the saved macro doesn't change the format.  It seems
this should work.  Thoughts?  The recorded macro is as follows:

8<-- code snip for brevity -->8
Sorry I can't help with your macro, but I like your idea.
An alternative approach I use, is to add my user defined date format to
my Calc default template.

Dave


Thank you for responding; I admire your style. I manually changed the
date format of my spreadsheet, saved , then coded it as the default
template. The default template took, but unfortunately, again the
user-defined date format wasn't saved.


Do I understand you can save a user-defined date format in the default
template and it takes? I'm sure a macro would work and I can wade
through the code, but if there's an easier way I'm interested.
I am not sure what you mean by "coded it as the default  template".
If you follow this procedure:
http://user.services.openoffice.org/en/forum/viewtopic.php?t=1161
the ".ots" (Calc template) file will include your date format, as would
be the case for any ODF file.
I am sending you (off-list) an example template which has a DD.MM.YYYY
date format, which is not included in standard list of date formats.
Open it and you will find 31.12.1999 at the end of the Format => Date ->
Category format list.

HTH

Dave

.

Thank you again for responding.  However, I think we're talking apples
and oranges.  I opened your template and the DD.MM.YYYY user-defined
format works.  My problem is I can't get the H:MMa/p user-defined Format
Code to take.  While the document is opened I can change 1:11PM to 1:11p
for instance.  However, after saving, closing, and reopening the
document the time appears as 1:11PM, not 1:11p, which is the format code
I wanted saved.  I've always been able to save the user-defined code, I
just can't get the lower-case a/p to take.  It does work with other file
formats.

That happens regardless of whether I save as an .ods or .ots file. I do
see the user-defined Format Code, but it always comes up as H:MMAM/PM
even though I save it as H:MMa/p.  I believe I originally created a
default template correctly, but just redid the process with your
instructions.  The same thing happens if I save the format in your
attached template.

So, can you successfully save the H:MMa/p format code?  That would
address the apples/oranges question.  I'd appreciate your testing that
if possible.  If it works for you I'm doing something wrong. It's not a
huge deal to manually change AM/PM to a/p each time I open the
spreadsheet, but not having to do so would be better.

Your "apples & oranges" analogy is correct. I was misled by your
original reference to "Date" format and although you spelled it out
quite clearly I overlooked the fact that your issue was with "Time" format.

I have now done some testing on this issue, with the following results:
* Saving from LO in ODF (".ods" or ".ots") format does not preserve the
user defined time format you want. (As you have already established.)
* Saving from LO in Excel (".xls") format and reopening it LO does
preserve the format. (As suggested by Pedro in another post to this thread.)

It may or may not be of importance to you, but opening the files saved
from LO and opening them in Excel 2010 I found:
* XLS File: Partially preserves the time format (ie. H:MM), but the
lower case p/m is becomes upper case P/M. The user defined cells are
"locked" (MS terminology) and "unlocking" them the format changes to
whatever MS deems to be appropriate.
* ODF File: Generates an error, which Excel generously offers to fix,
with the same result as for unlocking the cells in the XLS file.

Unless someone with a better knowledge of Star Basic than myself can
offer a solution to your macro problem, I suggest you file a bug/RFE
issue. https://www.libreoffice.org/get-help/bug/

Dave

-- 
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.