• 大小: 85KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-12
  • 语言: 其他
  • 标签: VC  Excell  源码  

资源简介

VC控制Excel的示范源码---介绍了VC控制Excel的一个范例,希望可以对大家有所启发

资源截图

代码片段和文件信息

//CAutoFont class implementation
//Modified by jingzhou xu
#include “stdafx.h“
#include “AutoFont.h“

CAutoFont::CAutoFont()
{
ZeroMemory( &lf sizeof( lf ) );  // fixed for uninitialized memory majun 7.26

lf.lfHeight=-12;
lf.lfWidth=0;
lf.lfEscapement=0;
lf.lfOrientation=0;
lf.lfWeight=FW_NORMAL;
lf.lfItalic=0;
lf.lfUnderline=0;
lf.lfStrikeOut=0;
lf.lfCharSet=DEFAULT_CHARSET; //ANSI_CHARSET;
lf.lfOutPrecision=OUT_DEFAULT_PRECIS;
lf.lfClipPrecision=CLIP_DEFAULT_PRECIS;
lf.lfQuality=PROOF_QUALITY;
lf.lfPitchAndFamily=VARIABLE_PITCH | FF_ROMAN;
strcpy(lf.lfFaceName “Times New Roman“);

CreateFontIndirect(&lf);

fontColor=0;
hDC=NULL;
}

CAutoFont::CAutoFont(CString facename)
{
ZeroMemory( &lf sizeof( lf ) );  // fixed for uninitialized memory majun 7.26

lf.lfHeight=-12;
lf.lfWidth=0;
lf.lfEscapement=0;
lf.lfOrientation=0;
lf.lfWeight=FW_NORMAL;
lf.lfItalic=0;
lf.lfUnderline=0;
lf.lfStrikeOut=0;
lf.lfCharSet=DEFAULT_CHARSET; //ANSI_CHARSET;
lf.lfOutPrecision=OUT_DEFAULT_PRECIS;
lf.lfClipPrecision=CLIP_DEFAULT_PRECIS;
lf.lfQuality=PROOF_QUALITY;
lf.lfPitchAndFamily=VARIABLE_PITCH | FF_ROMAN;
strcpy(lf.lfFaceName (LPCTSTR)facename);

CreateFontIndirect(&lf);

fontColor=0;
hDC=NULL;
}

CAutoFont::CAutoFont(LOGFONT& logfont)
{
ZeroMemory( &lf sizeof( lf ) );  // fixed for uninitialized memory majun 7.26

lf=logfont;
CreateFontIndirect(&lf);

fontColor=0;
hDC=NULL;
}

CAutoFont::CAutoFont(CFont font)
{
ZeroMemory( &lf sizeof( lf ) );  // fixed for uninitialized memory majun 7.26

HFONT hFont=(HFONT)font;
Attach((HFONT)hFont);

GetLogFont(&lf);

fontColor=0;
hDC=NULL;
}

CAutoFont::~CAutoFont()
{
}

LONG CAutoFont::SetHeight(LONG height)
{
LONG l=lf.lfHeight;

Deleteobject();
lf.lfHeight=height;
CreateFontIndirect(&lf);

return l;
}

LONG CAutoFont::SetHeightA(LONG height)
{
LONG l=lf.lfHeight;

Deleteobject();
if (height>0)
height=0-height;
lf.lfHeight=height;
CreateFontIndirect(&lf);

return l;
}

LONG CAutoFont::SetWidth(LONG width)
{
LONG l=lf.lfWidth;

Deleteobject();
lf.lfWidth=width;
CreateFontIndirect(&lf);

return l;
}

LONG CAutoFont::SetEscapement(LONG esc)
{
LONG l=lf.lfEscapement;

Deleteobject();
lf.lfEscapement=esc;
CreateFontIndirect(&lf);

return l;
}

LONG CAutoFont::SetOrientation(LONG or)
{
LONG l=lf.lfOrientation;

Deleteobject();
lf.lfOrientation=or;
CreateFontIndirect(&lf);

return l;
}

LONG CAutoFont::SetWeight(LONG weight)
{
LONG l=lf.lfWeight;

Deleteobject();
lf.lfWeight=weight;
CreateFontIndirect(&lf);

return l;
}

BYTE CAutoFont::SetCharset(BYTE charset)
{
BYTE b=lf.lfCharSet;

Deleteobject();
lf.lfCharSet=charset;
CreateFontIndirect(&lf);

return b;
}

BYTE CAutoFont::SetOutPrecision(BYTE op)
{
BYTE b=lf.lfOutPrecision;

Deleteobject();
lf.lfOutPrecision=op;
Cr

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2002-09-02 10:46  RWExcel\
     文件        7905  2002-07-29 17:34  RWExcel\AutoFont.cpp
     文件        2367  2002-07-29 17:34  RWExcel\AutoFont.h
     文件       10240  2002-09-02 12:12  RWExcel\Demo.xls
     文件       12654  2001-12-27 10:02  RWExcel\Hyperlink.cpp
     文件        3291  2001-12-27 10:02  RWExcel\Hyperlink.h
     文件       27614  2002-07-31 16:10  RWExcel\PictureEx.cpp
     文件        6810  2002-07-29 17:35  RWExcel\PictureEx.h
     文件         110  2002-09-02 12:14  RWExcel\ReadMe.txt
     目录           0  2002-09-02 10:47  RWExcel\res\
     文件        1005  2002-09-02 12:00  RWExcel\Resource.h
     文件       18270  2002-09-02 11:58  RWExcel\res\ButtonsWin3000.bmp
     文件       14333  2002-09-02 11:58  RWExcel\res\Flag.gif
     文件        1078  2002-09-02 10:47  RWExcel\res\RWExcel.ico
     文件         399  2002-09-02 10:47  RWExcel\res\RWExcel.rc2
     文件        1392  2002-09-02 12:05  RWExcel\RWExcel.clw
     文件        2852  2002-09-02 12:04  RWExcel\RWExcel.cpp
     文件        4833  2002-09-02 12:00  RWExcel\RWExcel.dsp
     文件         537  2002-09-02 10:47  RWExcel\RWExcel.dsw
     文件       81920  2002-09-02 12:12  RWExcel\RWExcel.exe
     文件        1564  2002-09-02 11:54  RWExcel\RWExcel.h
     文件        1990  2002-09-02 12:12  RWExcel\RWExcel.plg
     文件        6235  2002-09-02 12:11  RWExcel\RWExcel.rc
     文件       11440  2002-09-02 12:09  RWExcel\RWExcelDlg.cpp
     文件        1961  2002-09-02 12:07  RWExcel\RWExcelDlg.h
     文件         209  2002-09-02 10:47  RWExcel\StdAfx.cpp
     文件        1098  2002-09-02 11:17  RWExcel\StdAfx.h
     文件        9998  2002-09-02 12:08  RWExcel\WBButton.cpp
     文件        4718  2002-08-29 14:10  RWExcel\WBButton.h

评论

共有 条评论