Description: Fraction number format enables forced denominator, such as ?/4. But in some cases, user would prefer reduced fraction than exact forced denominator. Steps to reproduce: 1. Change number format: Format > Cells > Numbers, Category: Fraction 2. Enter format such as # ?/4 3. Enter values 0.25, 0.50, 0.75, 1.00, 1.25, 1.50, 1.75, 2.00 Actual behavior: Display 1/4, 2/4 (!), 3/4, 1, 1 1/4, 1 2/4 (!), 1 3/4, 2 Expected behavior: Previous display is correct, but user may expect 1/2 instead of 2/4 and 1 1/2 instead of 1 2/4 May be a number format such as # ?/(4) could be ok to have reduced fraction even with forced denominator?
Hi Laurent, Isn't that just #?/? I just did that and entered your values and got the results you suggested you wanted to see. For now closing as WFM - if I'm mistaken, apologies and of course toss it back into UNCONFIRMED.
(In reply to Joel Madero from comment #1) > Hi Laurent, > > Isn't that just #?/? > > I just did that and entered your values and got the results you suggested > you wanted to see. For now closing as WFM - if I'm mistaken, apologies and > of course toss it back into UNCONFIRMED. Sorry, I was not enough clear. I want *forced* denominator. Format with free denominator "# ?/?" like for your test gives reduced fraction. But format with forced denominator, like "# ?/4" or "# ??/16", cannot reduce the fraction representation. What I suggest is an option to have reduce fraction with forced denominator: Example: format "# ??/16" . Value 3.5 - without option (default behavior) should give "3 8/16" - with option should give "3 1/2" I have no clear idea how this option should be set. I may suggest to add a special delimiter at the end of the format, like #. In this case, format would look like "# ??/16#"
Created attachment 126053 [details] Example of forced denominator fraction format (In reply to Joel Madero from comment #1) > Hi Laurent, > > Isn't that just #?/? Some more details: "# ?/??" will actually reduce fraction. But, if I want rounded fraction each 1/16 inch for instance, then "# ?/??" will not round each 1/16. See attached example.
(In reply to Laurent BP from comment #3) > Some more details: "# ?/??" will actually reduce fraction. But, if I want > rounded fraction each 1/16 inch for instance, then "# ?/??" will not round > each 1/16. See attached example. Ah yes I see now. Confirming Version: 5.3.0.0.alpha0+ Build ID: 28a03248b1d1649e157b788e43dfe8326f165379 CPU Threads: 2; OS Version: Linux 3.16; UI Render: default; Locale: en-US (en_US.UTF-8)
@ Laurent BP so what you said is implement a new format code like (lets take 16 here this can be change too... no?) # ?/16# - which does reduced fraction even with forced denominator if we choose Format > Cells > Numbers, Category: Fraction as this code it will give output as you mentioned. as example having setup format like you said # ?/16# then enter 3.3125 -> 3 5/16 3.5 -> 3 1/2 3.45 -> 3 7/16 3.25 -> 3 1/4 1.0625 ->1 1/16
@ Laurent BP so what you said is implement a new format code like (lets take 16 here this can be change too... no?) # ?/16# - which does reduced fraction even with forced denominator if we choose Format > Cells > Numbers, Category: Fraction as this code it will give output as you mentioned. as example having setup format like you said in Format > Cells > Numbers, Category to # ?/16# then if we enter 3.3125 -> 3 5/16 3.5 -> 3 1/2 3.45 -> 3 7/16 3.25 -> 3 1/4 1.0625 -> 1 1/16 1.125 -> 1 1/8 simply if if the fraction part can be reduce output should be in reduced fraction form if not it should be in forced denominator form. in this case in x/16 where x is not divided by 16 is that you want....? if so I would like to try this bug
First make sure that such a format code can be stored in Excel files without interfering with how Excel interprets it and not makes it complain or throw away when reading. In this example # ?/16# is not accepted in Excel UI. Best of course would be if Excel supported denominator reduction with some format code, but I think it doesn't. Then we'd also need an ODF attribute extension to store such in ODF files.
(In reply to Nadith Malinda from comment #6) > is that you want....? > > if so I would like to try this bug I think you've got it. Yes, 16 was just an example. If you want to try this bug you may need some entry points: - calculation of fraction in SvNumberformat::ImpGetFractionOutput http://opengrok.libreoffice.org/xref/core/svl/source/numbers/zformat.cxx#ImpGetFractionOutput and for forced denominator http://opengrok.libreoffice.org/xref/core/svl/source/numbers/zformat.cxx#2464 - scan of format to detect forced denominator in ImpSvNumberformatScan::FinalScan http://opengrok.libreoffice.org/xref/core/svl/source/numbers/zforscan.cxx#FinalScan and more precisely http://opengrok.libreoffice.org/xref/core/svl/source/numbers/zforscan.cxx#1681 But as mentioned by Eike, first step would be to choose a correct coding
(In reply to Eike Rathke from comment #7) > First make sure that such a format code can be stored in Excel files without > interfering with how Excel interprets it and not makes it complain or throw > away when reading. In this example # ?/16# is not accepted in Excel UI. > Best of course would be if Excel supported denominator reduction with some > format code, but I think it doesn't. As you mentioned I thought How can we do this while supporting Excel.I came up with this idea but i don't know how good/bad that idea is,this is my idea we used the same format code # ?/16 (since it is accepted) and we put a simple button to toolbar to get the workdone. if button=true : reduced fraction form activated forced denominator form if button=false: only forced denominator form > > Then we'd also need an ODF attribute extension to store such in ODF files. I think then we don't need this extetion.isn't it?
(In reply to Laurent BP from comment #8) > But as mentioned by Eike, first step would be to choose a correct coding i commented, what I'm thinking to do for this bug as a reply to Eike . if you like it you can assign me for the bug.or if you have any suggestion tell me.I will try my best
(In reply to Nadith Malinda from comment #10) > (In reply to Laurent BP from comment #8) > > > But as mentioned by Eike, first step would be to choose a correct coding > > i commented, what I'm thinking to do for this bug as a reply to Eike . if > you like it you can assign me for the bug.or if you have any suggestion tell > me.I will try my best Feel free to assign yourself to this bug if you think you can tackle it :) You will need to extend ODF for this option because it will be specific for each format, not an option for a user. If you need, I could guide you for this.
(In reply to Laurent BP from comment #11) > You will need to extend ODF for this option because it will be specific for > each format, not an option for a user. > If you need, I could guide you for this. thank you .yes, I will need your help for ODF,First I will go through all the pointers you have given and try understand.
Hi Nadith, Please, next time you assign a bug to yourself, remember to change the status and the assignee. Regards
(In reply to Xisco Faulí from comment #13) > Hi Nadith, Hi. > Please, next time you assign a bug to yourself, remember to change the > status and the assignee. I was out for few days since I was busy with university exams.I would like to try this if you like
(In reply to Nadith Malinda from comment #14) > I would like > to try this if you like Umm.. try what exactly?
(In reply to Eike Rathke from comment #15) > Umm.. try what exactly? try this bug(enhancement) to fix it
Setting Assignee back to default. Please change it back if you're still working on this issue