aspose 小记

/// <summary>
/// 定位书签替换值
/// </summary>
/// <param name="documentBuilder"></param>
/// <param name="bookMark"></param>
/// <param name="bookMarkValue"></param>
public void ExistsBookmark(string bookMark, object bookMarkValue)
{
if (bookMarkValue != null)
{
if (docBuilder.MoveToBookmark(bookMark))
{
docBuilder.Write(bookMarkValue.ToString());

};

}


}

public void MoveToCellWriteValue(int tableindex, int rowsindex, int cellindex, string Value)
{
docBuilder.MoveToCell(tableindex, rowsindex, cellindex, 0);
docBuilder.Write(Value);
}

public void MergeCell(int tableindex, int rowindex)
{
for (int j = 0; j < 7; j++)
{
docBuilder.MoveToCell(tableindex, rowindex, j, 0);
docBuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.Previous;
}

}

public static void MergeCell(Table tb, int startrowid, int endrowid, int startColId, int endColId)
{
for (int i = startrowid; i <= endrowid; i++)
{
for (int j = startColId + 1; j <= endColId; j++)
{
//每行进行横向合并
HorizontallyMergeCells(tb.Rows[i].Cells[startColId], tb.Rows[i].Cells[j]);
}
}

tb.Rows[startrowid].Cells[startColId].CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
}

public static void HorizontallyMergeCells(Cell c1, Cell c2, bool SaveAllVal = false)
{
c1.CellFormat.HorizontalMerge = CellMerge.First;

//Move all content from next cell to previous
if (SaveAllVal)
{
foreach (Node child in c2.ChildNodes)
c1.AppendChild(child);
}

c2.CellFormat.HorizontalMerge = CellMerge.Previous;

}


public void insertRows(Table table, int rowindex)
{
Row rNs = table.Rows[rowindex].Clone(true) as Row;
table.InsertAfter(rNs, table.LastRow);

}

 

public ArrayList GetFinalDegreeSort(dynamic sampleInfo, string[] sortlist)
{
ArrayList GeneNewOrderArr = new ArrayList();
ArrayList GeneNewOrderArr1 = new ArrayList();//第一梯队,列出敏感与耐药的基因,按丰度排序
ArrayList GeneNewOrderArr2 = new ArrayList();//第二梯队,列出可能敏感与可能耐药的基因,按丰度排序
ArrayList GeneNewOrderArr3 = new ArrayList();//第三梯队,尚不明确的基因,按丰度排序
ArrayList GeneNewOrderArr4 = new ArrayList();//第三梯队,尚不明确的基因,按丰度排序
ArrayList GeneNewOrderArr5 = new ArrayList();//第三梯队,尚不明确的基因,按丰度排序
ArrayList GeneNewOrderArr6 = new ArrayList();//第三梯队,尚不明确的基因,按丰度排序
foreach (var item in sampleInfo)
{
if (item["finaldegree"].Value == sortlist[0].ToString())
{
GeneNewOrderArr1.Add(item);
}
else if (item["finaldegree"].Value == sortlist[1].ToString())
{
GeneNewOrderArr2.Add(item);
}
else if (item["finaldegree"].Value == sortlist[2].ToString())
{
GeneNewOrderArr3.Add(item);
}
else if (item["finaldegree"].Value == sortlist[3].ToString())
{
GeneNewOrderArr4.Add(item);
}
else
{
GeneNewOrderArr5.Add(item);
}

}
GeneNewOrderArr.Add(GeneNewOrderArr1);
GeneNewOrderArr.Add(GeneNewOrderArr2);
GeneNewOrderArr.Add(GeneNewOrderArr3);
GeneNewOrderArr.Add(GeneNewOrderArr4);
GeneNewOrderArr.Add(GeneNewOrderArr5);
return GeneNewOrderArr;
}

posted @ 2019-03-19 12:19  RookieMx  阅读(361)  评论(0编辑  收藏  举报