简体   繁体   English

如何在XQ消息中设置零件的内容类型

[英]How to set content type for part in XQ message

We can get content type by calling method: XQPart.getContentType() but I don't know how to set content type for the current part of XQ message 我们可以通过调用方法获取内容类型: XQPart.getContentType()但我不知道如何为XQ消息的当前部分设置内容类型

setContent(this.getContent(), "my_content_type") doesn't work setContent(this.getContent(), "my_content_type")不起作用

XQPart interface docs XQPart界面文档

setContent(this.getContentType(), "some_stuff") doesn't work setContent(this.getContentType(),“ some_stuff”)不起作用

This should be setContent("<your stuff>", "<content-type>"); 这应该是setContent("<your stuff>", "<content-type>"); , ie the first argument is the actual content and the second argument is its type. ,即第一个参数是实际内容,第二个参数是其类型。

Eg 例如

setContent("this is sample text", "text/plain");
setContent("<html><body>this is sample html</body></html>", "text/html");
setContent(<XQPart whose content is an excel sheet>, "application/vnd.ms-excel");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM