formatting

What's the difference between <tag></tag> and <tag /> in HTML? [duplicate]

柔情痞子 提交于 2020-01-10 04:18:29
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Using the XHTML closing slash (/) on normal tags? Are self-closing tags valid in HTML5? I'm reviewing a lot of HTML code and also JavaScript that synthesizes HTML and I noted that if there's some tag without content inside the tag then there're two way to specify it. Either like this: <div id="container"></div> or like this: <div id="container" /> Is there any difference between the two? 回答1: Browsers normalize

Calculate text height based on available width and font?

自作多情 提交于 2020-01-10 01:03:08
问题 We are creating PDF documents on the fly from the database using PDFsharp. I need to know the best way to calculate the height of the text area based on the font used and the available width. I need to know the height so I can process page breaks when required. 回答1: In .NET you can call Graphics.MeasureString to find out how large the drawn text is going to be. Right, but when using PDFsharp you call XGraphics.MeasureString. 回答2: The PdfSharp.Drawing.XGraphics object has a MeasureString

python centre string using format specifier

孤街醉人 提交于 2020-01-09 19:05:19
问题 I have a string called Message. Message = "Hello, welcome!\nThis is some text that should be centered!" Yeah, it's just a test statement... And I'm trying to centre it for a default Terminal window, i.e. of 80 width, with this statement: print('{:^80}'.format(Message)) Which prints: Hello, welcome! This is some text that should be centered! I'm expecting something like: Hello, welcome! This is some text that should be centered! Any suggestions? 回答1: You need to centre each line separately: '

python centre string using format specifier

試著忘記壹切 提交于 2020-01-09 19:04:46
问题 I have a string called Message. Message = "Hello, welcome!\nThis is some text that should be centered!" Yeah, it's just a test statement... And I'm trying to centre it for a default Terminal window, i.e. of 80 width, with this statement: print('{:^80}'.format(Message)) Which prints: Hello, welcome! This is some text that should be centered! I'm expecting something like: Hello, welcome! This is some text that should be centered! Any suggestions? 回答1: You need to centre each line separately: '

python centre string using format specifier

柔情痞子 提交于 2020-01-09 19:04:26
问题 I have a string called Message. Message = "Hello, welcome!\nThis is some text that should be centered!" Yeah, it's just a test statement... And I'm trying to centre it for a default Terminal window, i.e. of 80 width, with this statement: print('{:^80}'.format(Message)) Which prints: Hello, welcome! This is some text that should be centered! I'm expecting something like: Hello, welcome! This is some text that should be centered! Any suggestions? 回答1: You need to centre each line separately: '

Is there an easy way in .NET to get “st”, “nd”, “rd” and “th” endings for numbers? [duplicate]

杀马特。学长 韩版系。学妹 提交于 2020-01-09 02:03:02
问题 This question already has answers here : Is there an easy way to create ordinals in C#? (20 answers) Closed 5 years ago . I am wondering if there is a method or format string I'm missing in .NET to convert the following: 1 to 1st 2 to 2nd 3 to 3rd 4 to 4th 11 to 11th 101 to 101st 111 to 111th This link has a bad example of the basic principle involved in writing your own function, but I am more curious if there is an inbuilt capacity I'm missing. Solution Scott Hanselman's answer is the

Use a custom thousand separator in C#

与世无争的帅哥 提交于 2020-01-08 16:55:33
问题 I'm trying not to use the ',' char as a thousand separator when displaying a string, but to use a space instead. I guess I need to define a custom culture, but I don't seem to get it right. Any pointers? eg: display 1000000 as 1 000 000 instead of 1,000,000 (no, String.Replace() is not the solution I'd like to use :P) 回答1: I suggest you find a NumberFormatInfo which most closely matches what you want (i.e. it's right apart from the thousands separator), call Clone() on it and then set the

Use a custom thousand separator in C#

若如初见. 提交于 2020-01-08 16:55:13
问题 I'm trying not to use the ',' char as a thousand separator when displaying a string, but to use a space instead. I guess I need to define a custom culture, but I don't seem to get it right. Any pointers? eg: display 1000000 as 1 000 000 instead of 1,000,000 (no, String.Replace() is not the solution I'd like to use :P) 回答1: I suggest you find a NumberFormatInfo which most closely matches what you want (i.e. it's right apart from the thousands separator), call Clone() on it and then set the

how to turn off percentage sign in .net/wpf?

我的未来我决定 提交于 2020-01-07 03:52:06
问题 I would like my WPF application to display all percentages without % sign. For example 20% would be displayed as "20" but i still want to use the standard formatting for percentages (so i get the benefit of string formatter to multiply it by 100 for me) in other words, how do i get string.Format("0.00%", 0.2) to output "20" but not "20%"? Is it possible to globally define PercentSymbol as empty string for the entire application? In particular i am using ContentStringFormat in my WPF

Lock/Unlock a cell using conditional formatting

Deadly 提交于 2020-01-07 03:29:16
问题 How can I Lock/Unlock a cell(A1) based on value(yes/no) in another cell(A2) using conditional formatting? 回答1: There's lots of resources online showing how to do this. Here's an article that helped explain it to me: http://database.ittoolbox.com/groups/technical-functional/excel-l/how-to-lockunlock-an-excel-cell-based-on-the-contents-of-another-cell-4625040 In case that link dies, here is the gist of it: To do what you are describing, you will need to create an event procedure that Excel will