Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

Commented Unassigned: Underline work incorrectly [12655]

$
0
0
Workbook do not write correct information about font's underline.
I made some changes which allow workbook to save information correctly.
__Styles.cs__
```
// why to set single line as as default option ?

public CT_UnderlineProperty()
{
// this.valField = ST_UnderlineValues.single;
this.valField = ST_UnderlineValues.none;
}

public ST_UnderlineValues val
{
get
{
// return (null == valField) ? ST_UnderlineValues.single : (ST_UnderlineValues)this.valField;
return (null == valField) ? ST_UnderlineValues.none : (ST_UnderlineValues)this.valField;
}
set
{
this.valField = value;
}
}
```
__XSSFFont__

```
public FontUnderlineType Underline
{
get
{
CT_UnderlineProperty underline = _ctFont.sizeOfUArray() == 0 ? null : _ctFont.GetUArray(0);
if (underline != null)
{
return (FontUnderlineType)underline.val;

//FontUnderline val = FontUnderline.ValueOf((int)underline.val);
//return (FontUnderlineType)val.ByteValue;
}
return (FontUnderlineType)FontUnderline.NONE.ByteValue;
}
set
{
SetUnderline(value);
}
}

internal void SetUnderline(FontUnderlineType underline)
{
if (underline == FontUnderlineType.None && _ctFont.sizeOfUArray() > 0)
{
_ctFont.SetUArray(null);
}
else
{
CT_UnderlineProperty ctUnderline = _ctFont.sizeOfUArray() == 0 ? _ctFont.AddNewU() : _ctFont.GetUArray(0);
ST_UnderlineValues val = (ST_UnderlineValues)FontUnderline.ValueOf(underline).ByteValue; //.Value;
ctUnderline.val = val;
}
}

```
Comments: ** Comment from web user: zxm13588 **

When I using version 2.0.6,I have the same problem.


Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>