4

I am trying to apply inline styling to a cell within an Excel spreadsheet with the aim of having bold, non-bold and different coloured text within a single cell.

I am using the following:

<Row> <Cell ss:StyleID="s1"> <ss:Data ss:Type="String" xml:space="preserve" xlmns="http://www.w3.org/TR/REC-html40"><Font>Black text</Font><B>Bold text</B><Font html:Color="#FF0000">Red text</Font></ss:Data> </Cell> </Row> 

Unfortunately, this does not seem to have any effect. When I open in Excel, my text appears all black and non-bold.

I am completely stumped as I believe <Font html:Color="#FF0000">Red text</Font> and <B>Bold text</B> to be the correct elements to use.

Here is my full XML:

<?xml version="1.0" encoding="utf-8"?><?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <Author>John</Author> <LastAuthor>Smith</LastAuthor> <LastPrinted>2013-11-13T12:16:09Z</LastPrinted> <Created>2011-10-05T11:29:15Z</Created> <LastSaved>2014-02-03T15:36:18Z</LastSaved> <Company>Microsoft</Company> <Version>14.00</Version> </DocumentProperties> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <AllowPNG/> </OfficeDocumentSettings> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>9096</WindowHeight> <WindowWidth>22980</WindowWidth> <WindowTopX>0</WindowTopX> <WindowTopY>252</WindowTopY> <ProtectStructure>False</ProtectStructure> <ProtectWindows>False</ProtectWindows> </ExcelWorkbook> <Styles> <Style xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" ss:ID="s1"> <Alignment ss:Vertical="Top" ss:WrapText="1"/> <Borders> <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> </Borders> <Font xmlns:x="urn:schemas-microsoft-com:office:excel" ss:FontName="Calibri" x:Family="Swiss" ss:Size="11"/> </Style> </Styles> <Worksheet xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" ss:Name="PDA Printout"> <Table xmlns:x="urn:schemas-microsoft-com:office:excel"> <Column ss:Width="500"/> <Row> <Cell ss:StyleID="s1"> <ss:Data ss:Type="String" xml:space="preserve" xlmns="http://www.w3.org/TR/REC-html40"><Font>Black text</Font><B>Bold text</B><Font Color="#FF0000">Red text</Font></ss:Data> </Cell> </Row> </Table> </Worksheet> </Workbook> 
0

1 Answer 1

3

Is seems it is possible. You just made a typo. :)

Change xlmns to xmlns

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you for your comment, but I can confirm that Excel does support multiple styles within a single cell. This can be proved by creating a new Excel file, applying several styles within a single cell and then saving as XML Spreadsheet 2003.
@CraigJohnstone hey you're right. I'll remove this wrong answer and try to see why it doesn't work for you.
@CraigJohnstone Changed the answer. Please try it. I just saved a file with different formatting and copied the differences. :)
@CraigJohnstone Ah, you just made a typo. But I think it's good to keep this question as there where a lot of people saying it isn't possible when I searched for it.
Hours of banging my head on the desk over a typo! Thanks for you help :)
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.