formatting

Formatted output in OpenOffice/Microsoft Word with Python

一笑奈何 提交于 2020-01-12 19:29:30
问题 I am working on a project (in Python) that needs formatted, editable output. Since the end-user isn't going to be technically proficient, the output needs to be in a word processor editable format. The formatting is complex (bullet points, paragraphs, bold face, etc). Is there a way to generate such a report using Python? I feel like there should be a way to do this using Microsoft Word/OpenOffice templates and Python, but I can't find anything advanced enough to get good formatting. Any

How to convert a Rational into a “pretty” String?

為{幸葍}努か 提交于 2020-01-12 17:40:31
问题 I want to display some Rational values in their decimal expansion. That is, instead of displaying 3 % 4 , I would rather display 0.75 . I'd like this function to be of type Int -> Rational -> String . The first Int is to specify the maximum number of decimal places, since Rational expansions may be non-terminating. Hoogle and the haddocks for Data.Ratio didn't help me. Where can I find this function? 回答1: Here is an arbitrary precision solution that doesn't use floats: import Data.Ratio

How to convert a Rational into a “pretty” String?

自闭症网瘾萝莉.ら 提交于 2020-01-12 17:40:11
问题 I want to display some Rational values in their decimal expansion. That is, instead of displaying 3 % 4 , I would rather display 0.75 . I'd like this function to be of type Int -> Rational -> String . The first Int is to specify the maximum number of decimal places, since Rational expansions may be non-terminating. Hoogle and the haddocks for Data.Ratio didn't help me. Where can I find this function? 回答1: Here is an arbitrary precision solution that doesn't use floats: import Data.Ratio

How to convert a Rational into a “pretty” String?

爱⌒轻易说出口 提交于 2020-01-12 17:40:02
问题 I want to display some Rational values in their decimal expansion. That is, instead of displaying 3 % 4 , I would rather display 0.75 . I'd like this function to be of type Int -> Rational -> String . The first Int is to specify the maximum number of decimal places, since Rational expansions may be non-terminating. Hoogle and the haddocks for Data.Ratio didn't help me. Where can I find this function? 回答1: Here is an arbitrary precision solution that doesn't use floats: import Data.Ratio

Even page-break for double-sided printing in HTML & CSS

霸气de小男生 提交于 2020-01-12 17:30:48
问题 I've got page breaks working for print media with a quick page-break-after: always . I use these to separate multiple reports in a single batched print job. Unfortunately, when the print job is double-sided, the page break can cause the printer to start a report on the back of the previous report. Is there any way to force a page break to an even page? Or, alternatively, to detect which page number a certain element will appear on? 回答1: There's no built-in functionality in CSS for this. An

Prevent CKEditor from formatting code in source mode

帅比萌擦擦* 提交于 2020-01-12 02:43:23
问题 How can you prevent any automatic formatting when in CKEditor when viewing in source mode? I like to edit HTML source code directly instead of using the WYSIWYG interface, but whenever I write new lines, or layout tags how I would indent them, it all gets formatted when I switch to WYSIWYG mode and then back to source mode again. I stumbled upon a CKEditor dev ticket, Preserve formatting of ProtectedSource elements, that alluded to a setting which may have existed once upon a time which would

Week number and Week day

折月煮酒 提交于 2020-01-11 10:52:27
问题 I have week number of current year and week day generated by date() like this. $week_number = date('W'); $week_day = date('w'); I need to format this. How can I get starting date of this week? Or day of month with $week_number and $week_day? 回答1: Update : Maybe this article helps you. It describes how to get the start and end date of a given week. <?php // Monday echo date( datetime::ISO8601, strtotime("2006W37")); // Sunday echo date( datetime::ISO8601, strtotime("2006W377")); ?> Where the

Word 2007 VBA - Making some text BOLD & other ITALIC

喜你入骨 提交于 2020-01-11 10:23:21
问题 I have the following code that selects data from an Excel Cell & replaces a specific piece of text in my Word document (for purposes of this question, the Excel Cell has been replaced by a plain text string). The data ": goes to " is constant, then the data "aaa bbb" can be anything until we reach the " of " which is also constant. Then the data after the " of ", "ccc ddd eee" can be anything until it hits the " - " which is also constant. Is it possible to make the "aaa bbb" data BOLD &

Formatting numbers, excluding trailing zeroes

风流意气都作罢 提交于 2020-01-11 07:52:06
问题 first time SO user :) I know that I can format a number like this: format-number($value, '###,###.00') But I would like to remove the dot and the zeroes if $value is zero. So, 37368 -> 37,368 2.666667 -> 2.66 Is this possible using just number formatting (doesn't seem like it) or do I have to do something along the lines of if (int(value) == value ) {...} 回答1: format-number($value, '###,###.##') 回答2: xpath 2.0 contains conditional logic if..then..else but in the more likely case that you're

Formatting an SQL numeric query result with an arbitrary number of decimal places

时光怂恿深爱的人放手 提交于 2020-01-11 06:42:12
问题 I have a database table with these two columns: Amount: numeric (18,0) DecimalPlaces: numeric (18,0) This table can store amounts in various currencies, with the decimal place removed from the amount (I can't change this data model). For example, there might be two rows like this: 1290, 2 (This is £12.90, needs to appear as "12.90") 3400, 0 (This is 3400 Japanese Yen, needs to appear as "3400") I need an SQL query for both Oracle and SQL Server that will format each amount with the correct