找回密码
 立即注册

QQ登录

只需一步,快速开始

heer

注册会员

2

主题

9

帖子

25

积分

注册会员

积分
25

微信认证勋章

最新发帖
heer
注册会员   /  发表于:2019-9-24 19:41  /   查看:3860  /  回复:5
本帖最后由 heer 于 2019-9-25 14:20 编辑

读取C1Editor保持的xml文件(主要时C1Editor保持rtf文件不能同时保存图片),用C1Word合成rtf格式,设置字体为“游ゴシック”后另存成rtf文件,
再加载rtf文件赋值到C1FlexReport的rtf字段,
为什么预览时第一行最前端总是显示字体“游ゴシック”的文字呢?

谢谢


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

5 个回复

倒序浏览
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2019-9-25 09:52:10
沙发
抱歉,因为您这边是日文版本,没法帮你验证问题。

C1WORD一般来说只是用于创建生成word文档,你是用C1word读取保存的xml文档的吗
回复 使用道具 举报
heer
注册会员   /  发表于:2019-9-25 11:00:06
板凳
Richard.Ma 发表于 2019-9-25 09:52
抱歉,因为您这边是日文版本,没法帮你验证问题。

C1WORD一般来说只是用于创建生成word文档,你是用C1wo ...

谢谢版主及时回复,
因为C1Editor保存的是html格式数据,我们这边不能用C1Word直接读取以下格式:
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Untitled Page</title>
    <style type="text/css">
    body { font-family: Verdana; font-size: 9pt; }
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  </head>
  <body>
    <h1>Nikola Tesla</h1>
    <p>Nikola Tesla (10 July 1856 - 7 January 1943) was an inventor and a mechanical and electrical engineer.</p>
    <p>Tesla was born in the village of Smiljan near the town of Gospi&#263;, Vojna Krajina, in the territory of today's Croatia. He was an ethnic Serb subject of the Austrian Empire and later became an American citizen.</p>
    <p>Tesla is often described as an important <span style="color:Red">scientist and inventor of the modern age, a man who "shed light over the face of Earth". He is best known for many revolutionary contributions in the field of electricity and magnetism in the late 19th and early 20th centuries.</span></p>
    <p><span style="color:Red">Tesla's patents and theoretical work formed the basis of modern alternating current electric power (AC) systems, including the polyphase power distribution</span> systems and the AC motor, with which he helped usher in the Second Industrial Revolution. After his demonstration of wireless communication (radio) in 1894 and after being the victor in the "War of Currents", he was widely respected as one of the greatest electrical engineers who worked in America.<img width="321" height="241" src="file:///C:/Users/Public/Pictures/Sample Pictures/Tulips.jpg" alt="" /></p>
    <p>.</p>
  </body>
</html>


我们用System.IO.File.ReadAllText(xmlPath)读取后提取出文字与图片位置、尺寸,
再用C1Word的以下方法合成rtf格式并保存:

c1Word.AddParagraph(imgText.text, font, Color.Black, RtfHorizontalAlignment.Undefined);
c1Word.AddPicture(img, RtfHorizontalAlignment.Undefined);

保存后rtf格式内容:
\rtf1\ansi\ansicpg932\deff0\nouicompat\deflang1041\deflangfe1041{\fonttbl{\f0\froman\fcharset128{\*\panose 02020603050405020304}Times New Roman}{\f1\fswiss\fcharset128{\*\panose 020B0400000000000000}\u28216 ?\u12468 ?\u12471 ?\u12483 ?\u12463 ?}}{\colortbl;\red0\green0\blue0;\red255\green255\blue255;}{\stylesheet{\ql \li0\ri0\aspalpha\faauto \lang127\langfe127 \f0\fs24\cf1\lang127\langfe127 \snext0 Normal;}{\*\cs10 \additive\ssemihidden DefaultParagraphFont;}{\*\ts1 \tsrowd\trftsWidthB3\trpaddl78\trpaddr78\trpaddfl3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrr\tsbrdrb\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\aspalpha\faauto \lang127\langfe127 \f0\fs24\cf1\lang127\langfe127 \snext0 \ssemihidden TableNormal;}{\*\ls11 NoList;}}{\*\generator GrapeCity C1Word;}{\info{\title Unknown}{\author C1WordCreator}{\operator C1Word}{\creatim\yr2019\mo9\dy25\hr9\min35}{\revtim\yr2019\mo9\dy25\hr9\min35}{\company GrapeCity}}\paperw11906\paperh16838\margl1701\margr851\margt1134\margb1134 \fet0\sectd \pard\plain\nowidctlpar\ql \li0\ri0\aspalpha\faauto \lang127\langfe127 {\f1\fs19\cf1\lang127\langfe127 asdfasdf\u28216 ?\u12468 ?\u12471 ?\u12483 ?\u12463 ?FASDFASF}\par\pard\plain\nowidctlpar\ql \li0\ri0\aspalpha\faauto \lang127\langfe127 {\pict\pngblip\picw1470\pich375\picwgoal1470\pichgoal375\piccropl0\piccropr0\piccropt0\piccropb0 89504E470D0A1A0A0000000D4948445200000062000000190806000000CA40FB0C000000017352474200AECE1CE90000000467414D410000B18F0BFC6105000000097048597300000EC300000EC301C76FA864000001BB494441546843ED97C171C4200C45530BD5B8154AA1135DDC851A7125E47F6C6C201E67931CD06C7478335EBC7867F4FC25F6635DD7ECCCA788D8B6CD99888B30828B30828B30828B30828B308231119AD3127208AFB124FDF5DE106296EEB7E76250C49293DEDD1B907823A229AE6A96E139AA02FA352BBC59221A111015A5DEDBD1145F933C01D389B80A27392E29EB97EFB71C2220A0178667A465581B25CEC7AC0845F16AB1783D16B2D0C96913C16BDEC7E79A004D790978CEB742E76052448C6C2B90803EAF9C05287ADF66EE1282B563000BF627A489CF2872301B624C59983049B8C6ACE8F6CEC7A088F6ADBED2F19C06B28B48112229ADCE084A389E79B63ACA3D7FC70666458CADE9A544B46B4504F70BE4ECEB2529B55519C39888BD98420948C3E38C18457006A0E5D4CFD7BD3B69F6B025E228A66236F4FF139094F36DBE5A56B7B7FD7E27052246898D302B9812D1B6A3BDB052062C872B8FA53CF53029E3FF0322B119E8A3084FC44F18DEF4211114421111C398C7D254FA7FDDCBB7BE19BE2EE20FB0F06DCBA88940E179C261E1AF621E62EAC98747524AC39EAE053D614C8EA144

以上rtf格式与windows标准的rtf不同,会出现有个“GrapeCity C1Word”的信息,
请问如何能生成纯净的rtf格式呢?
回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2019-9-25 12:02:44
地板
{\*\generator GrapeCity C1Word;}{\info{\title Unknown}{\author C1WordCreator}{\operator C1Word}{\creatim\yr2019\mo9\dy25\hr9\min35}{\revtim\yr2019\mo9\dy25\hr9\min35}{\company GrapeCity}}

这一部分内容看起来是文件的一些详细信息,并不是内容。
你可以将生成的rtf文档发给我吗
回复 使用道具 举报
heer
注册会员   /  发表于:2019-9-25 14:20:49
5#
Richard.Ma 发表于 2019-9-25 12:02
{\*\generator GrapeCity C1Word;}{\info{\title Unknown}{\author C1WordCreator}{\operator C1Word}{\cre ...

附件已上传,请帮忙确认以下,谢谢
回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2019-9-25 15:35:22
6#
抱歉,没有分析出什么问题来,这个有可能是日文版本的开发包特有的问题,您还是需要和我们的日本葡萄城公司来联系,获取日文版的专门支持。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部