formatting

Can you make newline characters \n display as breaks <br />?

怎甘沉沦 提交于 2019-12-12 07:44:57
问题 I'm trying to display emails with IMAP. When the email is text though, the newlines \n don't display properly. I'd rather not convert them to breaks < br /> because if the user wanted to reply to that email, it would now be in HTML instead of plain text. Is there perhaps a javascript function that could display it as a line break without changing the code? 回答1: How about HTML/CSS? If you put your text inside a <pre> tag, it will show all newlines exactly as they were. Alternatively, you can

Use different fonts in same Excel cell?

人盡茶涼 提交于 2019-12-12 07:28:32
问题 Is there any way to change the color and/or font of specific text within an excel cell? That is, I'd like one part of the cell's displayed value to be red and another part of the same cell's displayed value to be blue (as an example). Since the displayed values are being calculated as formulas, I'd need some sort of formatting formula that would apply only the stuff inside the formula. I can't seem to find anything in the text. 回答1: If you want to do this based on a formula, you will have to

DataTables apply column formatting to filter also

天涯浪子 提交于 2019-12-12 07:13:04
问题 When creating a datatable with filter = 'top' and also using a formatting function on a column, the formatting isn't applied to the filter control for that column. Is there a way to format the filter controls as well? For example, if I have floating-point numbers formatted as a percentage, the slider in the filter still shows floating point numbers. library(DT) my_data <- mtcars my_data$wt_pctile <- trunc(rank(my_data$wt)) / length(my_data$wt) datatable(my_data, filter = 'top') %>%

python error : 'str' object has no attribute 'upper()'

陌路散爱 提交于 2019-12-12 07:07:20
问题 I'm discovering possibilities of string formatting with .format( ) method in Python 3 but i raised an error that i do not understand. So, why the following line is ok [wich let me think that "0" can be used exactly like the argument passed to format()]: s = 'First letter of {0} is {0[0]}'.format("hello") #gives as expected: 'First letter of hello is h' but not this one [applying a method or a function to 0 in {0} doesn't work?]: s = '{0} becomes {0.upper()} with .upper() method'.format("hello

How to display 5 multiples per line?

喜欢而已 提交于 2019-12-12 07:00:20
问题 I have to display a table for detecting multiples for 2 numbers. I'm having trouble formatting my output. The multiples should be printed left-aligned in columns 8 characters wide, 5 multiples per line. I know it should be simple but i cant figure out how to display 5 multiples per line. can anyone help? public class Multiples_Loop_Table { public static void main(String[] args) { int total = 0; //table heading System.out.println(" Integers from 300 to 200"); System.out.println(" -------------

Powershell - Output string to CSV and format

笑着哭i 提交于 2019-12-12 06:04:29
问题 I've given a simple example below. Does anyone know what I have to do to output the string into two columns. My searching has not returned much in the way of formatting outputs into CSV. Please point me in the right direction! Thanks!!! $LogFile = c:\somefile.csv "Hello World" | Out-File $LogFile 回答1: Reading your comments which supplement your question, creating a PSObject around the variables you are trying to export to CSV might give you more control over your output. Consider the

How do I set formatted text in Silverlight RichTextBox?

社会主义新天地 提交于 2019-12-12 05:00:49
问题 How can I make a RichTextBox show a string with format? I'm using Run but it dosen't work: // create a paragraph Paragraph prgParagraph = new Paragraph(); prgParagraph.FontFamily = new FontFamily("Comic Sans MS"); // create some text, and add it to the paragraph Run rnMyText = new Run(); rnMyText.Text = w.meaning; prgParagraph.Inlines.Add(rnMyText); rtxtMeaning.Blocks.Add(prgParagraph); 回答1: I know that this question is a couple years old, but I had the same question and here's what I came up

Formatting Integer with a decimal point

穿精又带淫゛_ 提交于 2019-12-12 04:58:15
问题 I have an integer value that is read from a PLC device via bluetooth and the first digit represent one decimal place. For example: 100 must be formatted to 10.0. Another examples: 500 -> 50.0 491 -> 49.1 455 -> 45.5 The following line will make it okay: data11.put("Text2", String.format("%.1f", (float)(mArray[18] & 0xFF | mArray[19] << 8) / 10.0)); But... Is there another way to do the same using String.format without divide by 10.0? Thank you 回答1: How about the following way? x = x.substring

How to print variable number of elements using sep and end?

强颜欢笑 提交于 2019-12-12 04:54:58
问题 I've been trying to use the sep='' to separate the numbers in between each other but they never separate unless I use end="" . However, when I switch sep='' with end="" it works properly. So, what am I doing wrong? Also, how do I separate the numbers in between with a "+" symbol without having it appear at the end? Thanks! #Counter numcounter=0 #Get starting integer from user s_num=int(input("Please enter a valid starting integer number: ")) #Get ending integer from user e_num=int(input(