I have a question on how best to get xhtml into excel. let the user edit it in excel and then get back to xhtml at the end.
我有一个关于如何最好地将xhtml变为excel的问题。让用户在excel中编辑它,然后在结束时返回到xhtml。
The background is that I have a web app in which the texts are stored in xhtml. These I can export to an excel file with the html in the excel cell.
背景是我有一个Web应用程序,其中的文本存储在xhtml中。这些我可以使用excel单元格中的html导出到excel文件。
I can also reimport this cell back to xhtml but the problem I have is that for editing it is very difficult to use for a normal user as the html is simply text in the excel cell.
我也可以重新导入这个单元格回到xhtml,但我遇到的问题是编辑它对于普通用户来说非常难以使用,因为html只是excel单元格中的文本。
Is this the wrong approach and should I just use a custom app with multiple html editors but the users would prefer an excel document they can easily exchange and work on offline.
这是错误的方法,我应该使用多个html编辑器的自定义应用程序,但用户更喜欢他们可以轻松交换和离线工作的Excel文档。
Here is a sample xml but it could be any xhtml which the user enters in the html editor (tinymce) with xhtml strict. I assume there is no html editor plugin for excel. I've never heard of one and haven't been able to find one as this would be the simplest solution..
这是一个示例xml,但它可以是用户在带有xhtml strict的html编辑器(tinymce)中输入的任何xhtml。我假设excel没有html编辑器插件。我从来没有听说过,因为这是最简单的解决方案,因此无法找到。
Review
* A Bullet: The impact of
* A bullet 2: Test text
Heading
* Bullet: text
* Bullet: Text
Anybody have any ideas? Thanks, Crocked
有人有什么想法吗?谢谢,Crocked
6 个解决方案
#1
If you're already familiar with XSLT, it sounds like that would be the best option. Although Excel 2003 doesn't use the .xlsx format, it does read (and save) what they call "SpreadsheetML", which is also XML. I've found that the easiest way to learn how to do the transforms to SpreadsheetML is just to open up a spreadsheet in Excel, format it however you like, then Save As->XML Spreadsheet (*.xml). Open up that XML file and you'll see all the styles Excel defined for your workbook, and you can then use those as a "template" to write XSLT that will transform your XHTML into that format.
如果你已经熟悉XSLT,听起来这将是最好的选择。虽然Excel 2003不使用.xlsx格式,但它确实读取(并保存)他们称之为“SpreadsheetML”的内容,它也是XML。我发现学习如何对SpreadsheetML进行转换的最简单方法就是在Excel中打开电子表格,然后根据需要对其进行格式化,然后另存为 - > XML电子表格(* .xml)。打开该XML文件,您将看到Excel为您的工作簿定义的所有样式,然后您可以将它们用作“模板”来编写XSLT,将XHTML转换为该格式。
For further reading and a decent walkthrough, look at Dive into SpreadsheetML (part 1 of 2) on MSDN.
有关进一步阅读和体面的演练,请参阅MSDN上的Dive into SpreadsheetML(第1部分,共2部分)。
Presumably you could then just use another XSL transform to pull out the data you need going from SpreadsheetML to XHTML.
据推测,您可以使用另一个XSL转换将您需要的数据从SpreadsheetML提取到XHTML。
#2
A solution I once implemented for my own personal use was that I wrote a macro in excel that parsed the html file and populated the excel sheet with only the data. When i was done, the macro would read the data in the sheet and generate the html file.
我曾经为自己个人使用的解决方案是我在excel中编写了一个宏来解析html文件并仅使用数据填充excel表。当我完成后,宏将读取工作表中的数据并生成html文件。
My case however had a very simple html file, and i basically had to only parse for a very few tags.
然而我的情况有一个非常简单的html文件,我基本上只需要解析很少的标签。
However you might be able to find a solution/utility which makes it easier for you to do that.
但是,您可能能够找到一个解决方案/实用程序,使您更容易这样做。
#3
Without seeing your specific documents, I can only select a general sort of solution.
如果没有看到您的具体文档,我只能选择一般的解决方案。
If you can break down the document by tags, you can display the data to the end user and store the tag information in a hidden worksheet. So, if you have:
如果您可以按标签分解文档,则可以将数据显示给最终用户,并将标记信息存储在隐藏的工作表中。所以,如果你有:
1-233
You could show 1, -2, and 33 in the first three cells of the visible worksheet and store td, td style="color:red", td in the matching cells on the invisible sheet. Then, you store the tag data out of sight, minimizing user confusion, and can retrieve it when you need to generate the xhtml file.
您可以在可见工作表的前三个单元格中显示1,-2和33,并在不可见工作表的匹配单元格中存储td,td style =“color:red”,td。然后,将标记数据存储在视线之外,最大限度地减少用户混淆,并在需要生成xhtml文件时检索它。
#4
Here is a sample xml but it could be any xhtml which the user enters in the html editor (tinymce) with xhtml strict. I assume there is no html editor plugin for excel. I've never heard of one..
这是一个示例xml,但它可以是用户在带有xhtml strict的html编辑器(tinymce)中输入的任何xhtml。我假设excel没有html编辑器插件。我从来没有听说过......
Review
- A Bullet: The impact of
- A bullet 2: Test text
子弹:影响
子弹2:测试文本
Heading
- Bullet: text
- Bullet: Text
#5
without seeing the complexity of the documents it may be hard but what about XSLT ? The excel itself if it is an .xlsx is xml. And either way it would export to XML. You could make an XSLT template that would transform it to the final xhtml document.
没有看到文档的复杂性可能很难但是XSLT呢? excel本身如果是.xlsx就是xml。无论哪种方式,它都会导出到XML。您可以创建一个XSLT模板,将其转换为最终的xhtml文档。
#6
My suggestion would be to actually do the following:
我的建议是实际执行以下操作:
xml to excel to xml
xml to excel to xml
My reasoning for this is that
我的理由就是这样
- User would be able to open the xml and actually get a basic understanding of the document (xhtml has useless tags they don't care about, like "html" or "head") since its clear and simple.
- Excel can open up xml files
- Easy for you to write a macro that exports the Excel Data to XML (lots of nice xml readers/writers)
- You can define an xslt template for that xml file, that would display it nicely as an html document.
- I noticed your comment about being limited to office 2003. You can define a xslt schema, and then if its simple enough, firefox or iexplorer will actually render it for you. You can check out browser support here: http://www.w3schools.com/xsl/xsl_browsers.asp
用户可以打开xml并实际获得对文档的基本了解(xhtml包含他们不关心的无用标签,如“html”或“head”),因为它清晰简单。
Excel可以打开xml文件
您可以轻松编写将Excel数据导出为XML的宏(许多不错的xml读者/编写者)
您可以为该xml文件定义一个xslt模板,该模板可以很好地显示为html文档。
我注意到你关于仅限于office 2003的评论。你可以定义一个xslt模式,然后如果它足够简单,firefox或iexplorer将实际为你呈现它。您可以在此处查看浏览器支持:http://www.w3schools.com/xsl/xsl_browsers.asp
#1
If you're already familiar with XSLT, it sounds like that would be the best option. Although Excel 2003 doesn't use the .xlsx format, it does read (and save) what they call "SpreadsheetML", which is also XML. I've found that the easiest way to learn how to do the transforms to SpreadsheetML is just to open up a spreadsheet in Excel, format it however you like, then Save As->XML Spreadsheet (*.xml). Open up that XML file and you'll see all the styles Excel defined for your workbook, and you can then use those as a "template" to write XSLT that will transform your XHTML into that format.
如果你已经熟悉XSLT,听起来这将是最好的选择。虽然Excel 2003不使用.xlsx格式,但它确实读取(并保存)他们称之为“SpreadsheetML”的内容,它也是XML。我发现学习如何对SpreadsheetML进行转换的最简单方法就是在Excel中打开电子表格,然后根据需要对其进行格式化,然后另存为 - > XML电子表格(* .xml)。打开该XML文件,您将看到Excel为您的工作簿定义的所有样式,然后您可以将它们用作“模板”来编写XSLT,将XHTML转换为该格式。
For further reading and a decent walkthrough, look at Dive into SpreadsheetML (part 1 of 2) on MSDN.
有关进一步阅读和体面的演练,请参阅MSDN上的Dive into SpreadsheetML(第1部分,共2部分)。
Presumably you could then just use another XSL transform to pull out the data you need going from SpreadsheetML to XHTML.
据推测,您可以使用另一个XSL转换将您需要的数据从SpreadsheetML提取到XHTML。
#2
A solution I once implemented for my own personal use was that I wrote a macro in excel that parsed the html file and populated the excel sheet with only the data. When i was done, the macro would read the data in the sheet and generate the html file.
我曾经为自己个人使用的解决方案是我在excel中编写了一个宏来解析html文件并仅使用数据填充excel表。当我完成后,宏将读取工作表中的数据并生成html文件。
My case however had a very simple html file, and i basically had to only parse for a very few tags.
然而我的情况有一个非常简单的html文件,我基本上只需要解析很少的标签。
However you might be able to find a solution/utility which makes it easier for you to do that.
但是,您可能能够找到一个解决方案/实用程序,使您更容易这样做。
#3
Without seeing your specific documents, I can only select a general sort of solution.
如果没有看到您的具体文档,我只能选择一般的解决方案。
If you can break down the document by tags, you can display the data to the end user and store the tag information in a hidden worksheet. So, if you have:
如果您可以按标签分解文档,则可以将数据显示给最终用户,并将标记信息存储在隐藏的工作表中。所以,如果你有:
1-233
You could show 1, -2, and 33 in the first three cells of the visible worksheet and store td, td style="color:red", td in the matching cells on the invisible sheet. Then, you store the tag data out of sight, minimizing user confusion, and can retrieve it when you need to generate the xhtml file.
您可以在可见工作表的前三个单元格中显示1,-2和33,并在不可见工作表的匹配单元格中存储td,td style =“color:red”,td。然后,将标记数据存储在视线之外,最大限度地减少用户混淆,并在需要生成xhtml文件时检索它。
#4
Here is a sample xml but it could be any xhtml which the user enters in the html editor (tinymce) with xhtml strict. I assume there is no html editor plugin for excel. I've never heard of one..
这是一个示例xml,但它可以是用户在带有xhtml strict的html编辑器(tinymce)中输入的任何xhtml。我假设excel没有html编辑器插件。我从来没有听说过......
Review
- A Bullet: The impact of
- A bullet 2: Test text
子弹:影响
子弹2:测试文本
Heading
- Bullet: text
- Bullet: Text
#5
without seeing the complexity of the documents it may be hard but what about XSLT ? The excel itself if it is an .xlsx is xml. And either way it would export to XML. You could make an XSLT template that would transform it to the final xhtml document.
没有看到文档的复杂性可能很难但是XSLT呢? excel本身如果是.xlsx就是xml。无论哪种方式,它都会导出到XML。您可以创建一个XSLT模板,将其转换为最终的xhtml文档。
#6
My suggestion would be to actually do the following:
我的建议是实际执行以下操作:
xml to excel to xml
xml to excel to xml
My reasoning for this is that
我的理由就是这样
- User would be able to open the xml and actually get a basic understanding of the document (xhtml has useless tags they don't care about, like "html" or "head") since its clear and simple.
- Excel can open up xml files
- Easy for you to write a macro that exports the Excel Data to XML (lots of nice xml readers/writers)
- You can define an xslt template for that xml file, that would display it nicely as an html document.
- I noticed your comment about being limited to office 2003. You can define a xslt schema, and then if its simple enough, firefox or iexplorer will actually render it for you. You can check out browser support here: http://www.w3schools.com/xsl/xsl_browsers.asp
用户可以打开xml并实际获得对文档的基本了解(xhtml包含他们不关心的无用标签,如“html”或“head”),因为它清晰简单。
Excel可以打开xml文件
您可以轻松编写将Excel数据导出为XML的宏(许多不错的xml读者/编写者)
您可以为该xml文件定义一个xslt模板,该模板可以很好地显示为html文档。
我注意到你关于仅限于office 2003的评论。你可以定义一个xslt模式,然后如果它足够简单,firefox或iexplorer将实际为你呈现它。您可以在此处查看浏览器支持:http://www.w3schools.com/xsl/xsl_browsers.asp