gpt4 book ai didi

html - 如何创建脚本将 excel 表格行转换为 HTML 页面?

转载 作者:行者123 更新时间:2023-11-28 06:10:15 27 4
gpt4 key购买 nike

我有一个 Excel 表格,其中包含本地企业的地址以及简短的描述。需要将此目录上传到我的 Wordpress 站点。

我希望表格中的每一行都是一个单独的 HTML 网页。我有一个 CSS 模板来设置内容的样式,但该表有超过 1000 个条目。因此,手动操作会很痛苦。

附言。如果有wordpress插件我可以用那个最方便了

最佳答案

以下代码在 CSS 中需要 C1、C2、...、Cx 等。

Dim sDir As String
Dim iRnd, iCnd, iRow, iCol As Integer
Dim oFso As Object
Dim oFil As Object

sDir = ActiveWorkbook.Path & "\"
iRnd = ActiveCell.SpecialCells(xlCellTypeLastCell).Row
iCnd = ActiveCell.SpecialCells(xlCellTypeLastCell).Column
Set oFso = CreateObject("Scripting.FileSystemObject")

For iRow = 1 To iRnd

Set oFil = oFso.CreateTextFile(sDir & iRow & ".html")
oFil.WriteLine "<html><body>"
For iCol = 1 To iCnd
oFil.WriteLine "<div class='C" & iCol & "'>" & Cells(iRow, iCol) & "</div>"
Next
oFil.WriteLine "</body></html>"
oFil.Close

Next

Set oFil = Nothing
Set oFso = Nothing

MsgBox "Done"

关于html - 如何创建脚本将 excel 表格行转换为 HTML 页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36212700/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com