MySQL 数据库到 Adob​​e InDesign

发布于 2024-11-02 21:14:51 字数 474 浏览 1 评论 0原文

不太确定这是否是发布此内容的正确位置,但认为这里的某人可能对此有一些经验。

我们有一个 MySQL 数据库,其中包含许多产品(实际上有 3,200 个)。出于显而易见的原因,我们不想在 InDesign 中重新输入所有内容来制作新一季的目录。有人有在 InDesign 中构建类似于 Microsoft“邮件合并”功能的经验吗?

还有另一个警告。 DB 中的项目有一个唯一的序列号,长度为 5 位。然后,我们有三个彩色条,它们根据商品序列号的最后两位数字进行颜色编码。例如,数字 12345 将具有三个垂直条,颜色分别为红色、绿色、红色(在我们的系统中,5 代表红色,4 代表绿色)。

有谁知道 InDesign 中是否提供这种功能?我认为也许可以生成一个以 PDF 格式输出所有内容的 PHP 文件,但由于我们可能需要编辑一些细节,因此我们理想情况下希望这些信息能够在 Adob​​e InDesign 中轻松获得和编辑。

如果有人有这方面的经验,我当然欢迎您的评论。

Not really sure if this is the correct place to posting this, but thought someone here might have a little experience with this.

We have a MySQL Database containing a number of products (well, 3,200 actually). For obvious reasons we don't want to have to retype everything into InDesign to produce our catalogue for the new season. Does anyone have experience with building something similar to the Microsoft 'Mail Merge' functionality in InDesign?

There's also another caveat. The items in the DB have a unique serial number, which is 5 digits in length. We then have three coloured bars which are colour-coded according to the last two digits of the item's serial number. For example, the number 12345 would have the three vertical bars coloured as red, green, red (in our system, 5 represents the colour red, and 4 represents the colour green).

Does anyone know if this kind of functionality is available in InDesign? I was thinking that it might be possible to generate a PHP file that outputs everything in a PDF format, but since we might need to edit a few details, we would ideally like this information to be readily available and editable in Adobe InDesign.

If anyone has experience with this, I would certainly welcome your comments.

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

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

发布评论

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

评论(7

差↓一点笑了 2024-11-09 21:14:51

上面的两个选项都可以将您的数据带入,但它们错过了您关于颜色的其他问题。我假设导入数据时您希望根据唯一的序列号自动显示颜色,对吗?

所以答案分为两部分: 1. 是的,您可以将数据导入为 XML。这将是最简单、最灵活的方法。数据合并对于短文档来说还可以,但对于大量数据来说就很麻烦了。数据合并最终会为每个数据记录创建一个文本框架。这将是很多额外的工作。

另一方面,可以导入 XML 以在文档中流动并自动填充页面,并根据段落和字符样式自行格式化。 《Adobe InDesign 和 XML 设计师指南》一书将教您如何导入 XML。

问题2:“如何生成彩色芯片”有点复杂。您必须编写 XSLT 来加载基于序列号中的数字的图形。我们对股票投资组合资料表中的星星进行了类似的操作,方法是使用 xsl:choose 例程根据 XML 中的数据选择正确的星星数量。例如:

<xsl:choose> 
<xsl:when test="name()='stars'">
<!--    <xsl:copy><xsl:apply-templates/></xsl:copy><xsl:text></xsl:text>-->
<xsl:choose> 
<xsl:when test="current()[.=2]"><stars>H H</stars>
</xsl:when>
<xsl:when test="current()[.=3]"><stars>H H H</stars>
</xsl:when>
<xsl:when test="current()[.=4]"><stars>H H H H</stars>
</xsl:when>
<xsl:when test="current()[.=5]"><stars>H H H H H</stars>
</xsl:when>
<xsl:otherwise></xsl:otherwise> 
</xsl:choose> 

您可以创建类似的例程,甚至可以从硬盘驱动器或服务器加载图形。将 XML 导入 InDesign 时,您会在 XML 导入选项对话框中加载 XSLT。这可以完成根据序列号加载色卡的工作。

除了能够构建图形芯片之外,XSLT 还可以根据需要插入段落回车符以及其他样板文本和空格来帮助您构建数据内容。我喜欢使用 插入 InDesign 所需的空白。它就像冠军一样工作。

很多时候 XML 文件没有空格或空格太多。 XSLT 方法将允许您根据需要添加、删除和控制生成的布局中的空白。

希望有帮助。

Both options above would work to bring your data in but they miss your other question regarding the colors. I am assuming when the data is imported you want to automatically display the colors according to the unique serial number, right?

So the answer is in two parts: 1. Yes, you can import the data as XML. This would be the easiest and most flexible way to do it. Data Merge is OK for short documents, but for lots of data it would be a bear. Data Merge ends up creating one text frame for each data record. That would be a lot of extra work.

XML on the other hand can be imported to flow through the document and fill pages automatically and format itself based on Paragraph and Character styles. The book: A Designer's Guide to Adobe InDesign and XML will teach you how to import the XML.

Question 2: "How do you generate the colored chips" is a bit more involved. You'd have to write an XSLT to load a graphic based on the numbers in the serial number. We did something similar to this with stars in a stock portfolio fact sheet by using an xsl:choose routine to pick the correct number of stars based on the data in the XML. Such as:

<xsl:choose> 
<xsl:when test="name()='stars'">
<!--    <xsl:copy><xsl:apply-templates/></xsl:copy><xsl:text></xsl:text>-->
<xsl:choose> 
<xsl:when test="current()[.=2]"><stars>H H</stars>
</xsl:when>
<xsl:when test="current()[.=3]"><stars>H H H</stars>
</xsl:when>
<xsl:when test="current()[.=4]"><stars>H H H H</stars>
</xsl:when>
<xsl:when test="current()[.=5]"><stars>H H H H H</stars>
</xsl:when>
<xsl:otherwise></xsl:otherwise> 
</xsl:choose> 

You could create a similar routine and even load graphics from the hard drive or server instead. When you import the XML into InDesign you load the XSLT in the XML import options dialog box. This could do the work for loading your color chips based on the serial number.

In addition to being able to build the graphic chips, the XSLT can help you structure the data content too by inserting paragraph returns and other boilerplate text and whitespace as needed. I like to use <xsl:text></xsl:text> to insert the whitespace that I need for InDesign. It works like a champ.

Many times XML files will have no whitespace or too much. The XSLT method will allow you to add, strip and control the whitespace in your resulting layout, as needed.

Hope that helps.

傲性难收 2024-11-09 21:14:51

InDesign 内置了非常强大的 XML 功能。并且,您可以使用 XSLT 使它们变得更强大。

我在 Adob​​e Press 提供的《Adobe InDesign 和 XML 设计师指南》一书中详细介绍了整个 XML 工作流程。或者,您可以查看我在 Lynda.com 上的“使用 Adob​​e InDesign 和 XML 的动态工作流程”的录音。

除了小目录之外,我不会将数据合并功能用于任何其他内容,编辑结果文件太困难了。

使用导入 XML 的流程方法,您可以使用正确的 XML 结构创建一个示例布局,然后使用克隆和过滤选项进行导入。

如果您需要重新排列数据元素,您可以在导入时使用 XSLT,或者通过在 MySQL 中创建查询并再次将数据导出为 XML 来生成不同的 XML 结构。

如上所述,通过在导入时使用 XSLT,您可以用图形替换数字。我们通过一份情况说明书做到了这一点,其中数字(例如 3)被替换为三颗星图形。

InDesign has very powerful XML features built right in. And, you can make them more powerful using XSLT.

I detail the entire XML workflow in my book "A Designers Guide to Adobe InDesign and XML" available from Adobe Press. Or, you can see my Lynda.com recordings for "Dynamic Workflows using Adobe InDesign and XML"

I wouldn't use the Data Merge function for anything other than a small catalog, it's too hard to edit the resulting file.

Using the flow method of importing XML you can create one sample layout using the proper XML structure, then import the import using the Clone and filtering options.

If you need to rearrange the data elements you can use an XSLT upon import or generate a different XML structure by creating a query in MySQL and exporting the data to XML again.

By using the XSLT upon import, as described above, you can replace the numbers with graphics. We did this with a fact sheet where a number, such as 3, was replaced with three star graphics.

一身软味 2024-11-09 21:14:51

首先必须准备XML格式的数据,导出为XML
然后,将 XML 导入到 InDesign 文档中(查看 -> 结构;导入 XML ...),该文档是之前在 InDesign 中准备好的

InDesign 处理 XML 数据,节省了很多时间

First you must prepare the data in XML format, export to XML
and then, import XML into the indesign document(View -> Structure; Import XML ...), which previously prepare in InDesign

InDesign works with the XML data, saving much time

九局 2024-11-09 21:14:51

您还可以尝试 InDesign 的 csv 文件数据合并功能。

You could also try out InDesign's data merge feature from a csv file.

泪眸﹌ 2024-11-09 21:14:51

我知道这是一个旧线程,但对于任何寻找颜色芯片部分的另一种解决方案的人来说,您可以在段落样式和字符样式中使用 GREP 来轻松完成此任务。

例如,使用上述 XML 工作流程将序列号拖放到您需要颜色条的位置。将段落样式(我们称之为“颜色条”)应用到此处的模板文本,并在段落样式的“GREP”选项中查找数字 3,并对其应用“红色”字符样式,其中字符样式使用下划线格式,根据您的需要进行缩放和样式设置。将同样的红色应用到数字 3 上,使其消失在下划线中。

这是基本的想法,调整字体(例如,也许您需要使用固定宽度的字体)、缩放和字体大小以获得您想要的间距和位置。

也许可以使用段落样式的“嵌套样式”功能将“白色”字符样式应用于前三个字母,以使它们消失在背景中。

I know this is an old thread, but for anyone looking for another solution to the color chip part, you can use GREP in the Paragraph Styles plus Character Styles to accomplish this pretty easily.

For instance, use the aforementioned XML workflow to drop the serial number in your location where you'll want the color bars. Apply a Paragraph Style, let's call it 'Color Bars', to the template text here, and in the Paragraph Style's 'GREP' options have it look for the number 3, and apply a Character Style of 'Red' to it, where that character style uses an underline format, scaled and styled to your needs. And apply that same red to the number 3 so that it vanishes into the underline.

That's the basic idea, fiddle with the font (for instance maybe you need to use a fixed-width font), scaling and font size to get the spacing and placement you're looking for.

And maybe use the Paragraph Style's 'Nested Styles' functionality to apply a 'white' character style to the first three letters to get those to vanish into the background.

老子叫无熙 2024-11-09 21:14:51

您可以使用 www.porky.io 进行 JavaScript 数据库访问。

而且不需要使用像xml这样的交换文件格式(当然是可以的),可以直接通过SQL查询。

对于数据库访问,有一个通过 php pdo 包含的示例。 mysql 应该很容易集成...

you can use www.porky.io for JavaScript database access.

And there's no need to use an exchange file format like xml (but of course it is possible), you can query directly via SQL.

For database access there's a sample included via php pdo. mysql should be easy to integrate...

人海汹涌 2024-11-09 21:14:51

您可以尝试 iziDBConnect。此 Adob​​e Indesign 插件有试用版。您可以从 Adob​​e Exchange 下载它。它直接连接到 MySQL。
http://www.izidbconnect.com/
接下来,也许您应该需要一个小脚本来将一些文本字段转换为图像。

You can try iziDBConnect. This add-on for Adobe Indesign has a trial version. You can download it from Adobe Exchange. It connects directly to MySQL.
http://www.izidbconnect.com/
Next, maybe, you should need a little script to transform some text fields into an image.

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