Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions OpenXmlFormats/Spreadsheet/Sheet/CT_Col.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,18 @@ public bool IsSetHidden()
}
public bool IsSetStyle()
{
return this.styleField!=null;
return this.styleField != null && this.styleField != 0;
}
public bool IsSetWidth()
{
return this.widthField > 0;
}

public bool IsSetNumber()
{
return min > 0 && max > 0;
}

public bool IsSetCollapsed()
{
return this.collapsedSpecifiedField;
Expand All @@ -125,6 +131,13 @@ public bool IsSetOutlineLevel()
{
return this.outlineLevelField != 0;
}

public void SetNumber(uint number)
{
min = number;
max = number;
}

public void UnsetHidden()
{
this.hiddenField = false;
Expand All @@ -135,7 +148,20 @@ public void UnsetCollapsed()
this.collapsedSpecified = false;
}

public void UnsetWidth()
{
this.widthField = -1;
}

public void UnsetCustomWidth()
{
this.customWidthField = false;
}

public void UnsetStyle()
{
this.styleField = 0;
}

[XmlAttribute]
public uint? style
Expand Down Expand Up @@ -286,9 +312,21 @@ internal void Write(StreamWriter sw, string nodeName)
sw.Write("/>");
}




public void Set(CT_Col col)
{
bestFitField = col.bestFitField;
collapsedField = col.collapsedField;
collapsedSpecifiedField = col.collapsedSpecifiedField;
customWidthField = col.customWidthField;
hiddenField = col.hiddenField;
maxField = col.maxField;
minField = col.minField;
outlineLevelField = col.outlineLevelField;
phoneticField = col.phoneticField;
styleField = col.styleField;
widthField = col.widthField;
widthSpecifiedField = col.widthSpecifiedField;
}

public CT_Col Copy()
{
Expand Down
20 changes: 19 additions & 1 deletion OpenXmlFormats/Spreadsheet/Sheet/CT_Cols.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,23 @@ public void SetColArray(List<CT_Col> array)
}
public CT_Col AddNewCol()
{
if (null == colField)
{
colField = new List<CT_Col>();
}

CT_Col newCol = new CT_Col();
this.colField.Add(newCol);
return newCol;
}

public CT_Col InsertNewCol(int index)
{
if (null == colField)
{
colField = new List<CT_Col>();
}

CT_Col newCol = new CT_Col();
this.colField.Insert(index, newCol);
return newCol;
Expand All @@ -40,7 +51,14 @@ public void RemoveCol(int index)
{
this.colField.RemoveAt(index);
}

public void RemoveCols(IList<CT_Col> toRemove)
{
if (colField == null) return;
foreach (CT_Col c in toRemove)
{
colField.Remove(c);
}
}
public int sizeOfColArray()
{
return col.Count;
Expand Down
6 changes: 6 additions & 0 deletions OpenXmlFormats/Spreadsheet/Sheet/CT_Comment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,11 @@ public string guid
this.guidField = value;
}
}

public void Set(CT_Comment comment)
{
this.authorId = comment.authorId;
this.text = comment.text;
}
}
}
30 changes: 30 additions & 0 deletions OpenXmlFormats/Vml/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,36 @@ public CT_TextPath textpath
}
}

public void Set(CT_Shape shape)
{
this.adj = shape.adj;
this.anchorlock = shape.anchorlock;
this.borderbottom = shape.borderbottom;
this.borderleft = shape.borderleft;
this.borderright = shape.borderright;
this.bordertop = shape.bordertop;
this.equationxml = shape.equationxml;
this.fill = shape.fill;
this.fillcolor = shape.fillcolor;
this.formulas = shape.formulas;
this.handles = shape.handles;
this.imagedata = shape.imagedata;
this.insetmode = shape.insetmode;
this.iscomment = shape.iscomment;
this.@lock = shape.@lock;
this.path = shape.path;
this.shadow = shape.shadow;
this.spid = shape.spid;
this.stroke = shape.stroke;
this.stroked = shape.stroked;
this.style = shape.style;
this.textbox = shape.textbox;
this.textdata = shape.textdata;
this.textpath = shape.textpath;
this.wrap = shape.wrap;
this.wrapcoords = shape.wrapcoords;
}

public CT_TextPath AddNewTextpath()
{
this.textpathField = new CT_TextPath();
Expand Down
14 changes: 14 additions & 0 deletions main/HSSF/UserModel/HSSFSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ public IRow CopyRow(int sourceIndex, int targetIndex)
{
return SheetUtil.CopyRow(this, sourceIndex, targetIndex);
}

/// <summary>
/// Copies comment from one cell to another
/// </summary>
/// <param name="sourceCell">Cell with a comment to copy</param>
/// <param name="targetCell">Cell to paste the comment to</param>
/// <returns>Copied comment</returns>
public IComment CopyComment(ICell sourceCell, ICell targetCell)
{
targetCell.CellComment = sourceCell.CellComment;

return targetCell.CellComment;
}

/// <summary>
/// used internally to Set the properties given a Sheet object
/// </summary>
Expand Down
Loading