乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > 怎样用C语言写一个程序,打开记事本,并输入一段文字-c 打开excel文件,c读取excel文件内容

怎样用C语言写一个程序,打开记事本,并输入一段文字-c 打开excel文件,c读取excel文件内容

作者:乔山办公网日期:

返回目录:excel表格制作


1.需要从网站下载zddsoframer.ocx文件
2.把dsoframer.ocx文件复制到c:\windows\system32目录下
开始->运行->regsvr32 dsoframer.ocx , 系统会提示DSOFramer.ocx中的DllRegisterServer成功。
3.在VS中新建项目,添加引用

4.将该控件加载到工具箱中(添加新选项)

5.将控件拖到窗体中
打开文件:this.axFramerControl1.Open(“文档地址”); //office的相关文档

注:此Dsoframer控制还有很多其它很好的方法和功能,可以去下载一个Dsoframer的使用接口说明文档

#include <stdlib.h>
#include <stdio.h>

#define Line 1024

int main()
{
//文件名及文件指针
char infile[]="D:\\Wtmp\\1.txt";
char outfile[]="D:\\Wtmp\\2.txt";
FILE *fpi,*fpo;

//暂存e799bee5baa6e79fa5e98193e58685e5aeb9365
char *outbuf;
outbuf = (char *)malloc(Line*sizeof(char));

if( ( fpi=fopen(infile,"r") ) == NULL )
{
printf("文件打开%s失败\n",infile);
return 3;
}
if( ( fpo=fopen(outfile,"w") ) == NULL )
{
printf("文件打开%s失败\n",outfile);
return 3;
}

while(1)
{
//outbuf要干净
//memset(outbuf,0,Line);
outbuf=0;

fprintf(fpo,"%s",outbuf);
if (fgets(outbuf,Line,fpi)==NULL)
{
break;
}//全部行结束退出循环

//DelStr(outbuf,"删除字符串"); //重载函数DelStr
//DelStr(outbuf,"要替换字符串","替换成字符串"); //重载函数DelStr
fprintf(fpo,"%s",outbuf);
}

//关闭文件
free(outbuf);
fclose(fpi);
fclose(fpo);
return 0;
}
没开发过,不够首先你需要的是去找个开源PDF库。否则你就要自己从底层写了。

。。了不起这是软件工程

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网