网站建设素材,肿瘤网,260115
aspose.words for c ++ 是一种高级word文档处理api,用于执行各种文档处理任务。api直接在您自己的c ++应用程序中提供文档格式化,操作,邮件合并,水印和更多功能,而无需microsoft word。api支持大多数microsoft word格式进行处理。
近期更新了aspose.words for c ++ v19.10,允许在同一项目中使用多个aspose产品,在skia上实现渲染引擎以提高渲染的质量和稳定性,具体更新内容同aspose.words for .net。
aspose.words for c ++与其等效的.net版本的api相比有一些差异:
本文将为大家介绍一个有趣的的功能——在word文档中创建重复节内容控件。
重复部分内容控件允许重复其中包含的内容。为此,sdttype枚举类型提供了repeatingsectionitem属性。下面的代码示例演示如何将word文档中的重复节内容控件绑定到表。
system::sharedptr<document> doc = system::makeobject<document>(); system::sharedptr<documentbuilder> builder = system::makeobject<documentbuilder>(doc); system::sharedptr<customxmlpart> xmlpart = doc->get_customxmlparts()->add(u"books", u"<books><book><title>everyday italian</title><author>giada de laurentiis</author></book><book><title>harry potter</title><author>j k. rowling</author></book><book><title>learning xml</title><author>erik t. ray</author></book></books>"); system::sharedptr<table> table = builder->starttable(); builder->insertcell(); builder->write(u"title"); builder->insertcell(); builder->write(u"author"); builder->endrow(); builder->endtable(); system::sharedptr <structureddocumenttag> repeatingsectionsdt = system::makeobject<structureddocumenttag>(doc, sdttype::repeatingsection, markuplevel::row); repeatingsectionsdt->get_xmlmapping()->setmapping(xmlpart, u"/books[1]/book", u""); table->appendchild(repeatingsectionsdt); system::sharedptr <structureddocumenttag> repeatingsectionitemsdt = system::makeobject<structureddocumenttag>(doc, sdttype::repeatingsectionitem, markuplevel::row); repeatingsectionsdt->appendchild(repeatingsectionitemsdt); system::sharedptr<row> row = system::makeobject<row>(doc); repeatingsectionitemsdt->appendchild(row); system::sharedptr <structureddocumenttag> titlesdt = system::makeobject<structureddocumenttag>(doc, sdttype::plaintext, markuplevel::cell); titlesdt->get_xmlmapping()->setmapping(xmlpart, u"/books[1]/book[1]/title[1]", u""); row->appendchild(titlesdt); system::sharedptr <structureddocumenttag> authorsdt = system::makeobject<structureddocumenttag>(doc, sdttype::plaintext, markuplevel::cell); authorsdt->get_xmlmapping()->setmapping(xmlpart, u"/books[1]/book[1]/author[1]", u""); row->appendchild(authorsdt); doc->save(outputdatadir + u"document.docx");复制代码
“ aspose.words for c ++” api现在提供了一种方法customdocumentproperties.addlinktocontent(string,string)来创建新的“链接至内容”自定义文档属性,该属性将返回新创建的属性对象;如果链接源无效,则返回null。下面的代码示例演示如何配置到内容定制属性的链接。
system::sharedptrdoc = system::makeobject(inputdatadir + u"test.docx"); // retrieve a list of all custom document properties from the file. system::sharedptrcustomproperties = doc->get_customdocumentproperties(); // add linked to content property. system::sharedptrcustomproperty = customproperties->addlinktocontent(u"propertyname", u"bookmarkname"); // also, accessing the custom document property can be performed by using the property name. customproperty = customproperties->idx_get(customproperties->indexof(u"propertyname")); // check whether the property is linked to content. bool islinkedtocontent = customproperty->get_islinktocontent(); // get the source of the property. system::string source = customproperty->get_linksource(); // get the value of the property. system::string value = customproperty->get_value()->tostring();
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论