Extract Rich Text Field from excel

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Extract Rich Text Field from excel

savan raiyani
Hi,

I am trying to fetch Rich text data from excel(data with applied styling like bold,italic,hyperlink etc.) and storing it as a RichTextString object but I am getting plain String object.

Do we have any way to keep and store styling of data and send it upfront?

If  I enter data with HTML tags in excel then I am getting styled data. Is this a only way to fetch Rich text data from excel?

Thanks in advance.

Regards
Savan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Extract Rich Text Field from excel

Jörn Franke
Can you provide a code snippet on how you get the  RichtextString? Maybe also a link (not attachment) to a formatted Excel to reproduce the problem?
It will facilitate troubleshooting significantly.

> Am 08.10.2019 um 21:06 schrieb savan raiyani <[hidden email]>:
>
> Hi,
>
> I am trying to fetch Rich text data from excel(data with applied styling like bold,italic,hyperlink etc.) and storing it as a RichTextString object but I am getting plain String object.
>
> Do we have any way to keep and store styling of data and send it upfront?
>
> If  I enter data with HTML tags in excel then I am getting styled data. Is this a only way to fetch Rich text data from excel?
>
> Thanks in advance.
>
> Regards
> Savan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Extract Rich Text Field from excel

Axel Howind-3
In reply to this post by savan raiyani
Hi,

you have to use [Cell.getRichStringCellValue()](https://poi.apache.org/apidocs/dev/org/apache/poi/ss/usermodel/Cell.html#getRichStringCellValue--). But I think questions like this rather belong in the [POI user list](https://lists.apache.org/list.html?user@...).

Axel

On 2019/10/08 11:40:54, savan raiyani <[hidden email]> wrote:

> Hi,
>
> I am trying to fetch Rich text data from excel(data with applied styling like bold,italic,hyperlink etc.) and storing it as a RichTextString object but I am getting plain String object.
>
> Do we have any way to keep and store styling of data and send it upfront?
>
> If  I enter data with HTML tags in excel then I am getting styled data. Is this a only way to fetch Rich text data from excel?
>
> Thanks in advance.
>
> Regards
> Savan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Extract Rich Text Field from excel

savan raiyani
In reply to this post by Jörn Franke
To reproduce excel data you can simply apply styling(bold,italic,hyperlink ,etc) to any cell data of excel
I am using Cell.getStringCellValue() to get that styled data but unfortunately getting plain string.

On 2019/10/08 12:55:34, Jörn Franke <[hidden email]> wrote:

> Can you provide a code snippet on how you get the  RichtextString? Maybe also a link (not attachment) to a formatted Excel to reproduce the problem?
> It will facilitate troubleshooting significantly.
> > Am 08.10.2019 um 21:06 schrieb savan raiyani <[hidden email]>:
> >
> > Hi,
> >
> > I am trying to fetch Rich text data from excel(data with applied styling like bold,italic,hyperlink etc.) and storing it as a RichTextString object but I am getting plain String object.
> >
> > Do we have any way to keep and store styling of data and send it upfront?
> >
> > If  I enter data with HTML tags in excel then I am getting styled data. Is this a only way to fetch Rich text data from excel?
> >
> > Thanks in advance.
> >
> > Regards
> > Savan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Extract Rich Text Field from excel

savan raiyani
In reply to this post by Jörn Franke
Here just small correction to my previous reply,my apologies.
To reproduce excel data you can simply apply styling(bold,italic,hyperlink ,etc) to any cell data of excel
I am using Cell.getRichStringCellValue() to get that styled data but unfortunately getting plain string.

On 2019/10/08 12:55:34, Jörn Franke <[hidden email]> wrote:

> Can you provide a code snippet on how you get the  RichtextString? Maybe also a link (not attachment) to a formatted Excel to reproduce the problem?
> It will facilitate troubleshooting significantly.
> > Am 08.10.2019 um 21:06 schrieb savan raiyani <[hidden email]>:
> >
> > Hi,
> >
> > I am trying to fetch Rich text data from excel(data with applied styling like bold,italic,hyperlink etc.) and storing it as a RichTextString object but I am getting plain String object.
> >
> > Do we have any way to keep and store styling of data and send it upfront?
> >
> > If  I enter data with HTML tags in excel then I am getting styled data. Is this a only way to fetch Rich text data from excel?
> >
> > Thanks in advance.
> >
> > Regards
> > Savan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Extract Rich Text Field from excel

savan raiyani
In reply to this post by Axel Howind-3
yes, I am using Cell.getRichStringCellValue() method to get styled value from excel but my only concern is I have to add my data with HTML tags.
If I use styling functionality provided by excel(bold.italic,hyperlink,etc) I am getting a plain string(without any styling) through  Cell.getRichStringCellValue() method.
Can you please suggest the way to pull styled data from excel if any?
Thanks for your reply.

On 2019/10/08 13:07:37, Axel Howind <[hidden email]> wrote:

> Hi,
>
> you have to use [Cell.getRichStringCellValue()](https://poi.apache.org/apidocs/dev/org/apache/poi/ss/usermodel/Cell.html#getRichStringCellValue--). But I think questions like this rather belong in the [POI user list](https://lists.apache.org/list.html?user@...).
>
> Axel
>
> On 2019/10/08 11:40:54, savan raiyani <[hidden email]> wrote:
> > Hi,
> >
> > I am trying to fetch Rich text data from excel(data with applied styling like bold,italic,hyperlink etc.) and storing it as a RichTextString object but I am getting plain String object.
> >
> > Do we have any way to keep and store styling of data and send it upfront?
> >
> > If  I enter data with HTML tags in excel then I am getting styled data. Is this a only way to fetch Rich text data from excel?
> >
> > Thanks in advance.
> >
> > Regards
> > Savan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Extract Rich Text Field from excel

Dominik Stadler
Hi,

Apache POI does not support this as far as I know, as you found Excel does
not store it this way and so it  would be very complicated to do this here.

Dominik

On Mon, Oct 21, 2019, 09:15 savan raiyani <[hidden email]>
wrote:

> yes, I am using Cell.getRichStringCellValue() method to get styled value
> from excel but my only concern is I have to add my data with HTML tags.
> If I use styling functionality provided by
> excel(bold.italic,hyperlink,etc) I am getting a plain string(without any
> styling) through  Cell.getRichStringCellValue() method.
> Can you please suggest the way to pull styled data from excel if any?
> Thanks for your reply.
>
> On 2019/10/08 13:07:37, Axel Howind <[hidden email]> wrote:
> > Hi,
> >
> > you have to use [Cell.getRichStringCellValue()](
> https://poi.apache.org/apidocs/dev/org/apache/poi/ss/usermodel/Cell.html#getRichStringCellValue--).
> But I think questions like this rather belong in the [POI user list](
> https://lists.apache.org/list.html?user@...).
> >
> > Axel
> >
> > On 2019/10/08 11:40:54, savan raiyani <[hidden email]>
> wrote:
> > > Hi,
> > >
> > > I am trying to fetch Rich text data from excel(data with applied
> styling like bold,italic,hyperlink etc.) and storing it as a RichTextString
> object but I am getting plain String object.
> > >
> > > Do we have any way to keep and store styling of data and send it
> upfront?
> > >
> > > If  I enter data with HTML tags in excel then I am getting styled
> data. Is this a only way to fetch Rich text data from excel?
> > >
> > > Thanks in advance.
> > >
> > > Regards
> > > Savan
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Extract Rich Text Field from excel

Axel Howind-3
In reply to this post by savan raiyani
Hi,

I am still not sure what your actual problem is. I suggest you create a small sample program and ask on stackoverflow.com.

Just two things:
- if you set a font, italics or color for the cell as a whole in Excel, that doesn't change the text contained a RichTextString. That information is stored in the CellStyle instead.
- if you store a styled text in Excel, i.e. not all but only some words/characters in the cell are underlined or use different font/colors, then you will get a RichTextString that can be used to extract the styling information via POI. As for example code, you can have a look at how I convert the POI RichTextString in my own [meja library](https://gitlab.com/com.dua3/lib/meja/blob/master/meja-poi/src/main/java/com/dua3/meja/model/poi/PoiCell.java#L572). I actually just convert the POI RichTextString into another class which I use for output in Swing applications or conversion to HTML/whatever. But it should give you an idea on how it can be done.

Axel

On 2019/10/21 07:15:34, savan raiyani <[hidden email]> wrote:

> yes, I am using Cell.getRichStringCellValue() method to get styled value from excel but my only concern is I have to add my data with HTML tags.
> If I use styling functionality provided by excel(bold.italic,hyperlink,etc) I am getting a plain string(without any styling) through  Cell.getRichStringCellValue() method.
> Can you please suggest the way to pull styled data from excel if any?
> Thanks for your reply.
>
> On 2019/10/08 13:07:37, Axel Howind <[hidden email]> wrote:
> > Hi,
> >
> > you have to use [Cell.getRichStringCellValue()](https://poi.apache.org/apidocs/dev/org/apache/poi/ss/usermodel/Cell.html#getRichStringCellValue--). But I think questions like this rather belong in the [POI user list](https://lists.apache.org/list.html?user@...).
> >
> > Axel
> >
> > On 2019/10/08 11:40:54, savan raiyani <[hidden email]> wrote:
> > > Hi,
> > >
> > > I am trying to fetch Rich text data from excel(data with applied styling like bold,italic,hyperlink etc.) and storing it as a RichTextString object but I am getting plain String object.
> > >
> > > Do we have any way to keep and store styling of data and send it upfront?
> > >
> > > If  I enter data with HTML tags in excel then I am getting styled data. Is this a only way to fetch Rich text data from excel?
> > >
> > > Thanks in advance.
> > >
> > > Regards
> > > Savan
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]