コード例 #1
0
 public virtual bool SetCell(int _rowleft, int _columntop, int _rowright, int _columnbottom, bool _ismerge, object _value, RangeStyle _rs)
 {
     bool flag = false;
     try
     {
         this.appCurRange = this.appCurSheet.get_Range(this.appCurSheet.Cells[_rowleft, _columntop], this.appCurSheet.Cells[_rowright, _columnbottom] as Range);
         if (_ismerge)
         {
             this.appCurRange.Merge(this.oMissing);
         }
         if (_rs != null)
         {
             _rs.SetStyle(ref this.appCurRange);
         }
         this.appCurRange.Value2 = _value;
         flag = true;
     }
     catch (Exception exception)
     {
         throw new ExcelException("设置单元格内容失败", exception);
     }
     return flag;
 }
コード例 #2
0
 public virtual bool SetCell(int _irow, int _icolumn, object _value, RangeStyle _rs)
 {
     return this.SetCell(_irow, _icolumn, _irow, _icolumn, false, _value, _rs);
 }
コード例 #3
0
 public virtual bool InsertImage(int _rowleft, int _columntop, string _imagepath, float _left, float _top, float _imageheight, float _imagewidth, RangeStyle _rs)
 {
     return this.InsertImage(_rowleft, _columntop, _rowleft, _columntop, false, _imagepath, _left, _top, _imageheight, _imagewidth, _rs);
 }
コード例 #4
0
 public virtual bool InsertImage(int _rowleft, int _columntop, int _rowright, int _columnbottom, bool _ismerge, string _imagepath, float _left, float _top, float _imageheight, float _imagewidth, RangeStyle _rs)
 {
     bool flag = false;
     try
     {
         this.appCurRange = this.appCurSheet.get_Range(this.appCurSheet.Cells[_rowleft, _columntop], this.appCurSheet.Cells[_rowright, _columnbottom] as Range);
         if (_ismerge)
         {
             this.appCurRange.Merge(this.oMissing);
         }
         if (_rs != null)
         {
             _rs.SetStyle(ref this.appCurRange);
         }
         this.appCurRange.Select();
         this.appCurSheet.Shapes.AddPicture(_imagepath, MsoTriState.msoFalse, MsoTriState.msoTrue, _left, _top, _imagewidth, _imageheight);
         flag = true;
     }
     catch (Exception exception)
     {
         throw new ExcelException("设置单元格的图片失败", exception);
     }
     return flag;
 }
コード例 #5
0
 public virtual bool InsertImage(int _rowleft, int _columntop, int _rowright, int _columnbottom, bool _ismerge, string _imagepath, RangeStyle _rs)
 {
     bool flag = false;
     try
     {
         this.appCurRange = this.appCurSheet.get_Range(this.appCurSheet.Cells[_rowleft, _columntop], this.appCurSheet.Cells[_rowright, _columnbottom] as Range);
         if (_ismerge)
         {
             this.appCurRange.Merge(this.oMissing);
         }
         if (_rs != null)
         {
             _rs.SetStyle(ref this.appCurRange);
         }
         this.appCurRange.Select();
         ((Pictures) this.appCurSheet.Pictures(this.oMissing)).Insert(_imagepath, this.oMissing);
         flag = true;
     }
     catch (Exception exception)
     {
         new QxClassErrLog { ErrClass = base.GetType().ToString(), MethodName = "InsertImage(int _rowleft, int _columntop, int _rowright, int _columnbottom, bool _ismerge, string _imagepath, RangeStyle _rs)", ErrContent = exception.Message }.WriteLog();
         throw new ExcelException("设置单元格的图片失败");
     }
     return flag;
 }