Home > Back-end >  C doc file compatibility problems
C doc file compatibility problems

Time:12-02

Recently written in c + + generated doc file, learned some posts, basically say the word and the WPS is compatible, when load the APP to determine once line, as follows:
 bool bWPS=true; 
CApplication wordApp;
if (! WordApp. CreateDispatch (_T (" KWPS. Application ")))
{
BWPS=false;
if (! WordApp. CreateDispatch (_T (" Word. Application ")))
{
AfxMessageBox (_T (" the machine is not installed WPS or word product!" ));
return;
}
}

I press the thinking about a program, bookmarks to update in the word file into the content of the need to, in the case of installation of word operation is normal, but the uninstall word, installing a WPS found two incompatible,
First, create a file when the two are different, the result of the code is as follows:

 cstrings dot=_T (" d: \ \ TMP \ \ 1. Doc "); 
COleVariant covOptional ((long) DISP_E_PARAMNOTFOUND, VT_ERROR),
Docx=docs. The Add (dot, covOptional, covOptional, covOptional);


Word case document called "1. Doc"; In cases where the WPS is "text text 1".
Second, save the file is different also, when the code is as follows:
 docx. SaveAs (COleVariant (dot), covOptional, covOptional, covOptional, covOptional, 
CovOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional,
CovOptional, covOptional, covOptional);

Word case save success; In cases where the WPS save failed, program interrupt (throw an error failure),
Creating a doc file which warrior written WPS please give directions, q: 807317689

CodePudding user response:

Has been solved, word and WPS process template file way is different, the docs. The Add (dot... ) is the dot file as a template file, word calls the Add close dot file after the and dot in the WPS file is opened, so save the dot file there are differences,
  • Related