wordpress hit counter
OpenXML Developer
Goodbye and Hello

OpenXmlDeveloper.org is Shutting Down

There is a time for all good things to come to an end, and the time has come to shut down OpenXmlDeveloper.org.

Screen-casts and blog posts: Content on OpenXmlDeveloper.org will be moving to EricWhite.com.

Forums: We are moving the forums to EricWhite.com and StackOverflow.com. Please do not post in the forums on OpenXmlDeveloper.org. Instead, please post in the forums at EricWhite.com or at StackOverflow.com.

Please see this blog post for more information about my plans moving forward.  Cheers, Eric

When reading the Rich Text present in Excel column using open XML its taking it as plain text

  • rated by 0 users
  • This post has 2 Replies |
  • 2 Followers
  • Hello All,

    When i am reading excel columns using open Xml in C# everything is working fine except the column that contain Rich Text (ex: bold, italic,color,size). Its reading the Rich Text content as plain text. As we know for Rich Text in open XML we get the text as Runs (C# object) which contains the text as value and rpr as run properties. I have also written the code to convert Runs to html. But the issue is that for some Rich Text format its reading it as Runs but most of the Rich Text its reading it as plain text.

    The issue i am getting is, for some rich text its creating RUN and for some of the rich text its not creatingRUN.

    Let me give the example for more understanding:

    Suppose i have two cells in excel which contains the below text.

    1. Rich Text 1

     2. RichText 2

    Now when i read these cells using the below code

    var stringTable =spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().FirstOrDefault();

    if (stringTable.SharedStringTable.ElementAt(index1).ChildElements.GetItem(0).GetType().Name == "Run")
    {

    Custom code to convert Rich text to HTML...

    }

    else

    {

    Read the plain text...

    }

    Though both the cell contains rich text, one is going in RUN block and one is going in Plain text bloc.

    Also, one thing that i have noticed is when i use standard color for text its consider it as RUNS and when i use color apart from the standard color it does not consider it as RUNS. Same behavior occurs for different combination of text viz. bold, italic, underline etc

  • <a href="topformtemplates.com/.../">free business cards templates for word</a> A format is a shape, form, or example utilized as a manual for making something. Here are a few cases:

    A ruler is a format when used to draw a straight line.

    A record in which the standard opening and shutting parts are as of now filled in is a layout that you can duplicate and after that fill in the variable parts.  

  •  A format is a shape, form, URL or example utilized as a manual for  Click here making something.  Link Here are a few cases:

    A ruler is a format when used to Blog draw a straight line.

    A record in which the standard Visit Us opening and shutting parts are as of  Ankur now filled in is a layout that you can duplicate  USER and after that fill in the variable  Website parts.  

Page 1 of 1 (3 items)