使用Word 2007作为CMS页面编辑器

发布于 2024-07-10 17:33:06 字数 157 浏览 8 评论 0原文

我已经搜索了几个小时,但我找不到任何关于此的信息...基本上我想为 word 2007 创建一个模板或插件,允许某人为 CMS 创建新页面。 我想到的是类似于博客文章模板的东西。 我知道如何创建基本模板,但找不到使用 Word 内的发布按钮发布创建的文档的方法。

提前谢谢

I have been searching for several hours but i couldn't find anything about this... Basically I would like to create a template or plug-in for word 2007 that would allow someone to create new pages for a CMS. What I have in mind is something similar to blog post template. I know how to create a basic template but I can't find a way to publish the created document using a publish button inside the Word.

thnx in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

小伙你站住 2024-07-17 17:33:06

我理解您想要实现的目标,但是 Word 是错误的起点。 我将从一个更基本的文本编辑器开始。

I understand what you are trying to achieve, but Word is the wrong starting point. I would start with a much more basic text editor.

書生途 2024-07-17 17:33:06

这个词太可怕了,太可怕了,太可怕了。 您的网站将定义清晰的样式,但 Word 将输出与您网站的 CSS 定义不匹配的令人讨厌的 HTML。

因此,最好的选择是找到一种方法将 Word 文件放入网站,并使用代码以编程方式分析它并将其转换为网站有效的 HTML。 在 Java 中,您可以使用 Apache POI,但这仍然非常原始。 在以微软为中心的世界中可能会容易得多。

在我看来,更好的做法是强迫人们学习 Markdown、BBCode 或 HTML,或者在 CMS 中使用样式化 HTML 编辑器 - 剪切并粘贴纯文本,然后使用 CMS 定义的样式进行样式设置。

Word is horrible, horrible, horrible. Your site will define clear styles, yet Word will output nasty HTML that won't match your website's CSS definitions.

Your best bet therefore is to have a means to drop the Word file into the site, and have code programmatically analyse it and transform it into site-valid HTML. In Java you could use Apache POI, but that's very raw still. Might be a lot easier in a Microsoft centric world.

Far better, in my opinion, is to force people to learn Markdown, or BBCode, or HTML, or to use a Styled HTML Editor in your CMS - cut and paste plain text in, then style with the CMS defined styles.

满栀 2024-07-17 17:33:06

当您使用 Word 2007 时,您可以将文档导出为 XML,然后使用 XSLT 生成 HTML。

如果您的 CMS 有 API 或导入工具,您可以转换 Word 的输出以适合该界面。

您可以编写 Word 宏以向 Word 添加“发布”按钮/菜单选项,从而生成正确的输出。

As you are using Word 2007 you can export the document as XML and then use XSLT to generate the HTML.

If your CMS has an API or import facility you could convert the output from Word to suit that interface.

You can write a Word macro to add a Publish button/menu option to Word that will generate the correct output.

咿呀咿呀哟 2024-07-17 17:33:06

这不是一个坏主意,因为一切都与最终用户有关。 如果 Word 生成错误的 HTML,您应该在将其发布到 CMS 之前使其语义正确。

我从来没有这样做过,但我确信可以通过“Word 2007 Addin”模板(假设是 Office 2007)使用 .NET。

祝你好运!

It's not a bad idea since it's all about the end user. If Word produces bad HTML, you should just make it semantic correct before posting it to the CMS.

I've never done this but I'm sure that it's possible to with .NET via the "Word 2007 Addin"-template (assuming Office 2007).

Good luck!

各自安好 2024-07-17 17:33:06

如果您使用 SharePoint 2007 作为 CMS,您可以做您想做的事情。 您可以在 SharePoint 2007 上设置博客并从 Word 发布到该博客。 如果您在客户端使用 Office 2007,那么您将获得一些不错的按钮,例如“发布到我的博客”等。

如果您无法使用 SharePoint 或正在谈论现有的 CMS,则您需要克服很多障碍。 这是一项重大任务,你无法从 Stack Overflow 中得到简单的答案。

You can do what you want if you use SharePoint 2007 as your CMS. You can set up a blog on SharePoint 2007 and post to the blog from Word. If you use Office 2007 on the client end then you will get some nice buttons like "post to my blog" etc.

If you can't use SharePoint or are talking about an existing CMS, you have a lot of hurdles to jump through. This is a major undertaking and not something you can get a simple answer out of Stack Overflow.

木槿暧夏七纪年 2024-07-17 17:33:06

Have you considered using one of the freely available Javascript WYSIWYG Editors such as TinyMCE http://tinymce.moxiecode.com/? When configured with all the options, it has an impressive amount of functionality and the interface is very similar to Word. I realize this doesn't directly answer your question, but as others have pointed out starting from Word is going to be difficult.

泪是无色的血 2024-07-17 17:33:06

我所在的团队为自定义 CMS 系统编写了 Word 插件。 它是用 VB6 编写的,能够获取 Word 文档并将基本格式信息(列表、粗体、斜体甚至表格)转换为 HTML,然后上传到服务器。 但它没有创建新页面或管理插件中的站点。

根据我的经验,我绝对会避免选择 Word 作为 CMS 的编辑器。 最大的问题是每次您想要更新插件时,您都必须将其重新分发给使用它的公司。 您可以将其作为 IE active-x 控件来实现,但通过 Javascript 编辑器让用户只能使用一组有限的样式选项要容易得多。

Word 确实有一个强大的 API 来操作您的内容,但是我们需要禁用 Word 中的许多选项以避免不需要的字体等,最终它比 Word 更像写字板。

如果这是一个全新项目并且您有时间,我实际上建议使用 Silverlight 4.0 而不是 Javascript 编辑器。 4.0版本内置了一个richtextbox控件,此外还有一个优秀的Vectorlight控件。

I've been on a team that wrote a Word addin for a custom CMS system. It was written in VB6 and was able to take a Word document and turn basic formatting information - lists, bold, italic and even tables into HTML, which was uploaded to the server. It didn't create new pages or manage the site in the addin though.

I would definitely avoid choosing Word as the editor for your CMS from my experience. The biggest issue is each time you want to update the addin you have to redistribute it to the company or companies using it. You can do this is as an IE active-x control but it's far easier just to handicap the user to a limited set of styling options via a Javascript editor.

Word does have a powerful API for manipulating your content with, however we needed to disable so many options in Word to avoid unwanted fonts and so on, it resembled Wordpad more than Word in the end.

If it's a greenfield project and you have the time, I would infact recommend using Silverlight 4.0 over a Javascript editor. Version 4.0 has a richtextbox control built in, plus there is also the excellent Vectorlight one.

秋千易 2024-07-17 17:33:06

也许对您有帮助,umbraco CMS 允许使用 Microsoft Word 进行编辑。

May be it helps you, umbraco CMS allow editing with Microsoft Word.

梦旅人picnic 2024-07-17 17:33:06

由于某种原因,Excel 喜欢此功能,而 Word 不喜欢。
当您保存文档时,Excel 可以自动发布文档的 HTML 文件版本。
不幸的是,Word 似乎只能在使用 Sharepoint 时实现此功能,这很遗憾,因为它非常有用。

除了创建自己的加载项之外,您还可以在模板中添加一些代码,以便在用户保存文档时创建文档的 HTML 副本。

  • 首先,确保您的模板启用了宏(保存为 .dotm 文件)。
  • 其次,在 Word 中编辑模板时,打开 VBA 代码编辑器 (ALT-F11)
  • project 列表中双击文档以打开其代码隐藏文件。
  • 向其中添加以下代码,将 ActiveDocument.SaveAs 路径修改为更适合您的路径,例如 CMS 公开的共享网络文件夹。

    子文件保存() 
          ' 首先保存主文档 
          ActiveDocument.保存 
          ' 现在我们根据当前文档创建一个新文档 
          选择.整个故事 
          选择.复制 
          文件.添加 
          Selection.PasteAndFormat wdPasteDefault 
          ' 将其另存为 HTML 并关闭它 
          ActiveDocument.SaveAs“c:\temp\mydoc.html”,文件格式:=wdFormatHTML 
          ActiveDocument.关闭 
      结束子 
      

这会将原始文件复制到一个空白的新文件中,该文件将保存为 HTML 并在返回到原始文件之前关闭。

如果您想使用与普通不同的模板,您可以检查Documents.Add的一些选项。

安全性

由于此模板包含宏,因此您必须将其与 Word 需要的其他模板一起安装。
如果不这样做,您将收到安全警告。
为了避免获取它,您可以将模板所在的路径添加到 Word 的“选项”>“受信任位置”列表中。 信任中心> 信任中心设置> 值得信赖的地点。

For some reason this is a feature that Excel enjoys but not Word.
Excel can can automatically publish an HTML file version of your document when you save it.
Unfortunately Word seems to only be able to achieve this functionality when using Sharepoint, which is a shame because it can be quite useful.

What you can do, short of creating your own add-in is to add a bit of code to your template to create a HTML copy of your document whenever the user saves it.

  • First, make sure your template is macro-enabled (saved as .dotm file).
  • Second, while editing the template in Word, open the VBA code editor (ALT-F11)
  • In the project list double-click on your document to open its code-behind file.
  • Add the following bit of code to it, modifying the ActiveDocument.SaveAs path to something more appropriate to you, like a shared network folder where your CMS exposed by your CMS.

    Sub FileSave()
        ' First Save the main document
        ActiveDocument.Save
        ' Now we create a new document based on the current one
        Selection.WholeStory
        Selection.Copy
        Documents.Add
        Selection.PasteAndFormat wdPasteDefault
        ' Save it as HTML and close it
        ActiveDocument.SaveAs "c:\temp\mydoc.html", fileformat:=wdFormatHTML
        ActiveDocument.Close
    End Sub
    

This will copy the original file into a blank new one that will be saved to HTML and closed before returning to the original file.

You can check some of the options to the Documents.Add if you want to use a different template than the normal one.

Security

because this template contains macros, you will have to install it with the other templates where Word expect them.
If you don't, then you'll get a security warning.
To avoid getting it, you can add the path where your templates are located to the list of Trusted Locations under Word's Options > Trust Center > Trust Center Settings > Trusted Locations.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文