Esempio n. 1
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;
 }
Esempio n. 2
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;
 }
Esempio n. 3
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;
 }