从文本文件中读取并写入c中的word文件 [英] Read from text file and write to word file in c

查看:120
本文介绍了从文本文件中读取并写入c中的word文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我想在C中设计包含文本文件作为输入的应用程序。我们必须从输入文件读取行,因为第一行包含关键字NET,下一行包含关键字'LOC'同时读取这两行并以表格格式写入word文档作为一列中的第一行和第二列中的第二行。还根据用户给出的第三个输入对表项进行排序。

在我的应用程序中,我试图从文本文件中读取文本文件中的行并按原样写入单词,但不是表格格式。如何以表格格式写入单词?

Hi!
I want to design application in C which contains text file as input.In that we have to read line from input file as first line contains keyword 'NET' and next line containing keyword 'LOC'.Read these two lines at same time and write to word document in table format as first line in one column and second line in second column of table.Also sort table entries according to third input given by user.
In my application i tried to read line from text file from text file and write to word as it is,but not in table format.How to write entries in table format of word??

推荐答案

正如Richard所写,C#是一种可能的方式 - 不仅如此,而且是微软为此目的设计的natutarl接口。 (所以没有其他的)



C中的另一种解决方案是写入 RTF格式。
As Richard wrote C# is a possible way - not only, but it is the "natutarl interface" which microsoft designs for such purposes. (So there is no other)

An alternative solution in C is to write in RTF Format which word can read.


Word可以理解许多数据格式。提到了富文本格式。将您的数据文件写为html文件,并创建自己的包含数据的表标记。 Word会毫不费力地阅读它并显示它。



如果你想变得非常疯狂,你可以编写一个XSL处理器,其中规则发出HTML但是是一个非常高级的主题。
Word can understand many data formats. Rich text format was mentioned. Write your data file as html file and create your own table markup containing your data. Word will read this without any trouble and display it.

If you want to get really fancy crazy you can write an XSL processor in which the rules emit the HTML but that is a very advanced topic.


这篇关于从文本文件中读取并写入c中的word文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆