如何在没有库的情况下使用doc | docx文件?只有纯C代码? [英] How to work with doc|docx files without libraries? Only pure C code?

查看:105
本文介绍了如何在没有库的情况下使用doc | docx文件?只有纯C代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

有人能告诉我,我如何在Windows中的Pure C / Masm中使用MS Word文件(在其中搜索文本,编写,创建)?可能有人有例子,代码的一部分等等。



我尝试过的事情:



我没有尝试任何东西,因为我不知道如何开始..

解决方案

方法是编写自己的解析器那些文件格式......

这里的捕获 - DOC是私有的(微软拥有的)格式,从未向公众发布...

DOCX是一个开放域名格式......

所有这些意味着你不能为DOC写一个可靠的解析器,但可以用于DOCX ...

对于DOCX检查这些:

Office Open XML - Wikipedia [ ^ ]

[MS-DOCX]:Office Open XML(.docx)文件格式的Word扩展 [ ^ ]


你不想要一个库,但也许是您可能会对此库的源代码感兴趣: GitHub - DocxFactory / DocxFactory:包含C#,Java,Python,Progress的跨平台C / C ++库用于生成Microsoft Word .DOCX(OpenXML)文件的4GL包装器和命令行工具 [ ^ ]

它可以与C和其他语言一起使用。


引用:

如何在Windows中的Pure C / Masm中使用MS Word文件(在其中搜索文本,编写,创建)?



如果不这样做想要使用现有的库,你必须重新创建它们,值得花几年时间。

引用:

我不知道如何开始。

首先,你需要找到文件格式规范(有超过1个版本),不幸的是,.doc文件格式不公开,所以如果你不是,那么找到它们可能会很困难比尔盖茨最好的朋友。

一旦你拿到它们,至少计划一年时间来完全理解它们。

换句话说,你做什么是不合理的想要。



由于.docx嵌入到.eip文件格式中,您还需要重新创建.zip库。


Hello
Can anybody tell me, how I can work with MS Word files (search text in it, write,create) in Pure C/Masm in Windows? May be somebody have example, part of code, etc.

What I have tried:

I don't trying anything, because i don't know how to start..

解决方案

The way is to write your own parser for those file formats...
And here the catch - DOC is a private (Microsoft owned) format, that never been released to the public...
DOCX is an open domain format...
All this means that you can not write a reliable parser for DOC, but can for DOCX...
For DOCX check these:
Office Open XML - Wikipedia[^]
[MS-DOCX]: Word Extensions to the Office Open XML (.docx) File Format[^]


You did not want a library, but maybe the source code of this library might be of interest to you: GitHub - DocxFactory/DocxFactory: Cross platform C/C++ library with C#, Java, Python, Progress 4GL wrappers and command line tools for generating Microsoft Word .DOCX (OpenXML) files[^]
It can be used with C and other languages.


Quote:

how I can work with MS Word files (search text in it, write,create) in Pure C/Masm in Windows?


If you don't want to use existing libraries, you have to recreate them, it is worth a few years of work.

Quote:

i don't know how to start.


First, you need to find the files formats specifications (there is more than 1 version), unfortunately, .doc file formats are not public, so just finding them may be difficult if you are not the best friend of Bill Gates.
Once you got them, plan at least a year to fully understand them.
In other words, it is not reasonable to do what you want.

Since .docx are embedded into a .eip file format, you also need to recreate a .zip library.


这篇关于如何在没有库的情况下使用doc | docx文件?只有纯C代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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