Browse Source

Merge branch 'master' of https://github.com/dotnetcore/NPOI

master^2 v1.2.2-preview
Savorboard 5 years ago
parent
commit
4bd03852b0
  1. 1
      src/NPOI.OOXML/XWPF/Usermodel/XWPFNumbering.cs
  2. 20
      src/NPOI.OOXML/XWPF/Usermodel/XWPFParagraph.cs
  3. 4
      src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs
  4. 11
      src/NPOI.OpenXmlFormats/Wordprocessing/Paragraph.cs

1
src/NPOI.OOXML/XWPF/Usermodel/XWPFNumbering.cs

@ -249,6 +249,7 @@ namespace NPOI.XWPF.UserModel
int pos = abstractNums.Count;
if (abstractNum.GetAbstractNum() != null)
{ // Use the current CTAbstractNum if it exists
abstractNum.GetAbstractNum().abstractNumId = pos.ToString();
ctNumbering.AddNewAbstractNum().Set(abstractNum.GetAbstractNum());
}
else

20
src/NPOI.OOXML/XWPF/Usermodel/XWPFParagraph.cs

@ -1340,6 +1340,26 @@ namespace NPOI.XWPF.UserModel
return xwpfRun;
}
/**
* Appends a new hyperlink run to this paragraph
*
* @return a new hyperlink run
*/
public XWPFHyperlinkRun CreateHyperlinkRun(string rId)
{
CT_R r = new CT_R();
r.AddNewRPr().rStyle = new CT_String() { val = "Hyperlink" };
CT_Hyperlink1 hl = paragraph.AddNewHyperlink();
hl.history = ST_OnOff.on;
hl.id = rId;
hl.Items.Add(r);
XWPFHyperlinkRun xwpfRun = new XWPFHyperlinkRun(hl, r, this);
runs.Add(xwpfRun);
iRuns.Add(xwpfRun);
return xwpfRun;
}
/**
* insert a new Run in RunArray
* @param pos

4
src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs

@ -50,7 +50,9 @@ namespace NPOI.OpenXmlFormats.Spreadsheet
if (node == null)
return null;
CT_PatternFill ctObj = new CT_PatternFill();
if (node.Attributes["patternType"] != null)
if (node.Attributes["patternType"] == null)
ctObj.patternType = ST_PatternType.solid;
else
ctObj.patternType = (ST_PatternType)Enum.Parse(typeof(ST_PatternType), node.Attributes["patternType"].Value);
foreach (XmlNode childNode in node.ChildNodes)
{

11
src/NPOI.OpenXmlFormats/Wordprocessing/Paragraph.cs

@ -371,6 +371,17 @@ namespace NPOI.OpenXmlFormats.Wordprocessing
return r;
}
public CT_Hyperlink1 AddNewHyperlink()
{
CT_Hyperlink1 hl = new CT_Hyperlink1();
lock (this)
{
itemsField.Add(hl);
itemsElementNameField.Add(ParagraphItemsChoiceType.hyperlink);
}
return hl;
}
[XmlElement("ItemsElementName", Order = 2)]
[XmlIgnore]
public List<ParagraphItemsChoiceType> ItemsElementName

Loading…
Cancel
Save