formatting

Is there anywhere a Java library available that supports exactly the format strings of Excel?

For a Java application that drags data together from some sources and does some calculation itself, we want to offer users the possibility to use their own format strings, and would prefer the format string syntax they know from Excel (e. g. "$ "#,###.,0) which happens to be the same used in .net and Analysis Services. The closest thing...

using xsl displays nothing

i'm trying to implement an xsl file to an xml doc. however when i do so, it displays nothing. if i remove the reference of the xsl from the xml file, the data at least is displayed. this is the xsl code: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:temp...

Why has this particular TimeSpan format string stopped working in .NET 4?

Consider this code (prestuffed with an example): DateTime dt1 = DateTime.Parse("7/30/2010 9:33:29.1234567 AM"); DateTime dt2 = DateTime.Parse("6/30/2010 9:33:00.7654321 AM"); TimeSpan ts = dt1 - dt2; Console.WriteLine(string.Format( "{0:d.hh:mm:ss.ff}", ts )); This is representative of a piece of code that I've had working since .NE...

Aligning 3 texts (left, center and right) in a DIV

Hello, I am trying to make a sort of progress bar that gets filled, with text inside that is on the left, in the center, and SOMETIMES on the right. I got it (almost) working, my only issue so far is that sometimes the text in the middle gets too long, and so it gets spanned out of the div. Meaning it wraps around, and takes sort of 2 ...

TSQL 2008 Using LTrim(RTrim and still have spaces in the data

I have data I cleaning up in an old data table prior to moving it to a new one. One of the fields has spaces in the column, right & left. I wrote the following code to address this and still have leading spaces?? The bulk of the data is clean when using this code but for some reason there are spaces prior to RT addresses... Has anyone ...

String formatting issues and concatenating a string with a number

I'm coming from a c# background, and I do this: Console.Write("some text" + integerValue); So the integer automatically gets converted to a string and it outputs. In python I get an error when I do: print 'hello' + 10 Do I have to convert to string everytime? How would I do this in python? String.Format("www.someurl.com/{0}/blah...

Formatting a number in gridview

Hi all,i have a gridview that shows some indicators.one of the numbers is a computed percentage it looks like this "33.33333333333333333333333333333333333333" i tried to set the DataFormatString property of the column to several different formats such as "{0:P}" ,"{0:D}" and "{0:##.##}" but nothing worked for me to show it like that "33....

Eclipse formatter vs Checkstyle inconsistency

Hi, we are using an eclipse formatting profile, that states that line width is 125 characters and that the method parameters should be wrapped when necessary. Now this line does not get broken in two: public FeaturePart(final Long fooBarBarBarBar, final String foo, final int sequenceNumber, final boolean fooBarBarBazBar) { Note t...

Formatting elements in columns and rows

To avoid reinventing the wheel, I am generating a form using CakePHP's form helper, which create the following markup: <div class="input select"><label for="ReportFruit">Fruit</label> <input type="hidden" name="data[Report][Fruit]" value="" id="ReportFruit" /> <div class="checkbox"><input type="checkbox" name="data[Report]...

Hide content after 3 paragraphs <p>

Hi all, Working with an API that spits out the contents in p tags ... but it gets too long. Thinking of hiding them upon reaching a limit of 400 characters, but that's not a good idea since there is a possibility of it cutting through a HTML tag. So I'm trying to hide the rest of the content after 3 paragraphs instead and with a text ...

GridView how to apply string format to item

Hello, I have the following code in the columns section of my GridView: <Columns> <asp:boundfield datafield="Nominal-Anual" HeaderText="Nominal anual"/> <asp:boundfield datafield="Anual" headertext="Anual" sortexpression="Anual" /> <asp:boundfield datafield="Semestral" headertext="Semestral" DataFormatString="{0:0.00...

How to print formatted BigDecimal values?

I have a BigDecimal field amount which represents money. And I need to print its value in the browser in format like $123.00, $15.50, $0.33. How can I do that? (Еhe only simple solution which I see myself is getting floatValue from BigDecimal and then using NumberFormat to make 2 digits presision for the fraction part). ...

Text to HTML in PHP.

Hello, nl2br(); can do for EOL but what about white spaces and/or tabs at the beginning(or not) of line? Is there any function to do this at once? I need well formatted html output of text file. Thx. ...

Sitecore: Forcing pasting as unformatted text.

Is there a good way to force pasting as text inside Rich Text Fields inside Sitecore? I know there's a "Paste as Text" button in the Rich Text Editor itself, but content authors are almost definitely going to just hit Ctrl+V or Right-Click->Paste to put the text in, and if that content came from Word, all hell breaks loose with the marku...

Format number as ranking position

Possible Duplicate: Is there an easy way in .NET to get st, nd, rd and th endings for numbers? Is there anything already built into C# that formats a number as a ranking position? By "ranking position" is mean one of ["st","nd,"rd","th"] eg : (1st, 2nd, 3rd, 4th). I know it'd be easy to write an extension for this, I'm just ...

inline formatting of a tooltip of an itemrenderer of a datagrid?

How to style parts of the tooltip e.g. bold? I’m generating a tooltip in an itemrenderer for an datagrid, displaying the column name and then the value: I want to display the value bold… public override function set data(value:Object):void { var dg:DataGrid = this.listData.owner as DataGrid; var dataField:String = (dg.columns[this.l...

Insert code into a latex doc. without leading tabs

When I write latex I usually indent my sections like this (it allows easier folding in vim, is like reading code, etc). section{section} bla bla bla bla bla subsection{a} bla bla bla bla bla subsection{b} bla bla bla bla bla The problem is when I insert code (see below) into my document if I indent t...

What's the proper way to show money in an UI in Java?

On the backend I'm storing money values in a Money class which wraps a BigDecimal and sets rounding to be always Half Even with scale 8. All basic operations work fine and behave as expected. But I need to show those values to the user with scale of 2, and that's bringing me rounding errors. For example, I have these values in the backe...

When exporting gridview to xls, the entire row is formatted. How can I limit this to my gridview columns

I have a gridview that I am exporting to an excel file. When I open the excel file, the alternating row color extends to the end of the excel table, but I only want my 6 data columns to be formatted. How can I limit the formatting? My gridview: <asp:GridView ID="grdExportable" runat="server" BackColor="White" ForeColor="Black" ...

Problem with \t \n with NSString

I have a plist where I place my strings, with type string. When I access the strings in the plist, it doesnt interpret \n and \t. So when I display these strings it will display \tTitle and not Title with tab indention. But if I use #define str1 @"\tTitle" and just place it in header files, it works. Please help. ...