e

//ExcelUtil.h


#include "stdafx.h"
#include <io.h>
#include "CApplication.h"
#include "CFont0.h"
#include "CRange.h"
#include "CWorkbook.h"
#include "CWorkbooks.h"
#include "CWorksheet.h"
#include "CWorksheets.h"
#include "comdef.h"
#include "comutil.h"
//using namespace TypelibExcel;e


namespace TypelibExcel {


class CExcel{
private:
CString out_file_name;
public:
CString GetOutFileName()
{
return out_file_name;
};
void SetOutFileName(CString new_file_name)
{
if (new_file_name.GetLength()>0)
out_file_name = new_file_name;
}


CExcel()
{
;
}
~CExcel()
{


}
private:
CApplication m_excelApp;
CWorkbooks    m_excelBooks;
CWorkbook    m_excelBook;
CWorksheets   m_excelSheets;
CWorksheet   m_excelSheet;
CRange        m_excelRange;


public:
void CreateExcel();
void OpenExcel(CString fileName);
bool SaveExcel();
void CloseExcel();

CWorksheet GetSheet(CString SheetName);

CWorksheet GetSheet(int index);

CWorksheet AddSheet(CString SheetName);
int GetSheetNum();
CString GetCell(int ColNum, int RowNum);

void SetRange(int ColNum, int RowNum);
void SetRange(int StartColNum, int StartRowNum, int EndColNum, int EndRowNum);

void Merge(int startRowIndex, int startColIndex, int endRowIndex, int endColIndex);
void SetCellValue(CString value);


void SetCellValue(int row, int col, CString value);
void SetCellStringFormat();
void SetCellValue( int startRow,int startCol, int endRow, int endCol, CString value );
CString GetCellValue( int row, int col );

void SetBoldFontAndSize( int size );

void SetAutoFitColumns( int startRow, int startCol, int endRow, int endCol );


void SetCenterAlign();


// void SetBorder()
// {
// Borders borders = m_excelRange.GetBorders();
// borders.SetLineStyle(COleVariant((short)1));
// 
// Border border = borders.GetItem(7);
// border.SetWeight(COleVariant((short)4));
// border = borders.GetItem(8);
// border.SetWeight(COleVariant((short)4));
// border = borders.GetItem(10);
// border.SetWeight(COleVariant((short)4));
// border = borders.GetItem(9);
// border.SetWeight(COleVariant((short)4));
// }
};
};
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值