public Texts MapNewText(int[] destColumnsWidth) { Texts reMapTexts = new Texts(); foreach (SignRowTextBlock rowRootBlock in this) { if (rowRootBlock.Count >= destColumnsWidth.Length) { //从两头往中间映射 Texts beginTexts = new Texts(); Texts endTexts = new Texts(); for (int beginPtr = 0, endPtr = rowRootBlock.Count - 1, destEptr = destColumnsWidth.Length - 1; beginPtr <= endPtr && beginPtr <= destEptr; beginPtr++, endPtr--, destEptr--) { if (!rowRootBlock[beginPtr].EmptyBlock) { if (beginPtr == endPtr) { beginTexts.Add(rowRootBlock[beginPtr].Text.CopyInNewLoction(beginPtr + 1, beginPtr + 1)); break; } beginTexts.Add(rowRootBlock[beginPtr].Text.CopyInNewLoction(beginPtr + 1, beginPtr + 1)); } if (!rowRootBlock[endPtr].EmptyBlock) { endTexts.Insert(0, rowRootBlock[endPtr].Text.CopyInNewLoction(destEptr + 1, destEptr + 1)); } } reMapTexts.AddRange(beginTexts); reMapTexts.AddRange(endTexts); } else if (rowRootBlock.Count == 1) { reMapTexts.Add(rowRootBlock[0].Text.CopyInNewLoction(1, destColumnsWidth.Length)); } else { //使用插桩分组方式 //0.053064275 0.156950673 0.091928251 0.200298954 0.183856502 0.313901345 //0.086956522 0.204508857 0.09178744 0.161030596 0.086956522 0.095008052 0.120772947 0.152979066 //能插入的位置为 1 ,2 , 3 ,4 ,5, 6, 7 取1 2 3 4 6 映ColumnIndex为 11 22 33 44 56 78 blockPercent = rowRootBlock.BlockPercent(); columnPercent = GetColumnPercent(destColumnsWidth); List <Point> groupLocation = GroupColumnArray(); for (int i = 0; i < rowRootBlock.Count; i++) { if (!rowRootBlock[i].EmptyBlock) { reMapTexts.Add(rowRootBlock[i].Text.CopyInNewLoction(groupLocation[i].X + 1, groupLocation[i].Y + 1)); } } } } return(reMapTexts); }
public Texts GetTextsBy(int bandIndex) { Texts bandTexts = new Texts(); foreach (Text text in this) { if (text.BandIndex == bandIndex) { bandTexts.Add(text); } } return(bandTexts); }
public Texts GetTextsBy(int bandIndex, int rowIndex) { //行Text应该以从左到右的顺序排列 Texts searchTexts = new Texts(); foreach (Text text in this) { if (text.BandIndex == bandIndex && text.Location.Y1 == rowIndex) { searchTexts.Add(text); } } return(searchTexts); }
private Texts reMapTexts(Texts tempRowTexts, int[] usedColumns, int[] x1columns, int[] x2columns) { if (usedColumns == null) { return(tempRowTexts); } Texts texts = new Texts(); foreach (Text text in tempRowTexts) { try { if (usedColumns[text.Location.X1] != 0) { texts.Add(text.CopyInNewLoction(text.Location.X1 + x1columns[text.Location.X1], text.Location.X2 + x2columns[text.Location.X2])); } else if (usedColumns[text.Location.X1] == 0 && text.Location.X2 != text.Location.X1) { //处理表头 页汇合并性的问题 Text tempText = text.CopyInNewLoction(text.Location.X1 + x1columns[text.Location.X1] + 1, text.Location.X2 + x2columns[text.Location.X2]); if (tempText.Location.X1 <= tempText.Location.X2) { texts.Add(tempText); } } } catch { Function.Alert("文本合并越界", "提示"); } } return(texts); }