//第5行8列,张拉示意图
m_fpSpread.ActiveSheet.AddSpanCell(rowNo, columnNo, 5, 1);
m_fpSpread.ActiveSheet.Cells[rowNo, columnNo].VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;
m_fpSpread.ActiveSheet.Cells[rowNo, columnNo].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
m_fpSpread.ActiveSheet.Cells[rowNo, columnNo].Border = m_siThinBorder.Border;
m_fpSpread.ActiveSheet.Cells[rowNo, columnNo].CellType = m_imageCellType;
//m_fpSpread.ActiveSheet.Cells[rowNo, columnNo].Value = m_ReportData._reportHead._bitSchemeValue;
System.Drawing.Rectangle rec = m_fpSpread.GetCellRectangle(0, 0, rowNo, columnNo);
FarPoint.Win.Spread.DrawingSpace.RectangleShape shape = new FarPoint.Win.Spread.DrawingSpace.RectangleShape();
//从内存中获取图片使用这句代码
shape.BackgroundImage = new FarPoint.Win.Picture(m_ReportData._reportHead._bitSchemeValue);
//排除 SheetConner 影响位置
shape.Top = rec.Top - (int)this.m_fpSpread.ActiveSheet.SheetCorner.Rows[0].Height;
shape.Left = rec.Left - (int)this.m_fpSpread.ActiveSheet.SheetCorner.Columns[0].Width;
shape.Width = rec.Width;
shape.Height = rec.Height;
m_fpSpread.ActiveSheet.AddShape(shape);
columnNo += 1;
以上是我的代码,但是我导出来后行,列都有一个单位错位,我把
System.Drawing.Rectangle rec = m_fpSpread.GetCellRectangle(0, 0, rowNo, columnNo);
改成
System.Drawing.Rectangle rec = m_fpSpread.GetCellRectangle(0, 0, rowNo+1, columnNo+1);
后也不对
导出文件参见附件
11.rar
(6 KB, 下载次数: 266)
|