java 合并和拆分单元格
Whether you want to merge collections of short stories into a DIY anthology, or you want to split a greatest-works volume you recently acquired into the author’s individual novels, you can follow along as we show you how to merge and split ebooks with ease.
无论您是要将短篇小说集合并为DIY选集,还是要将最近获得的最伟大的著作拆分为作者的个人小说,您都可以按照我们的步骤向我们展示如何轻松地合并和拆分电子书。
我为什么要这样做? (Why Do I Want to Do This?)
There’s all manner of motivations for wanting to split or combine ebooks in your collection. Perhaps you break up a massive anthology into small pieces, combine collections of poetry into a mega volume, or create one big master copy of every single Robert Heinlein book so you can use the progress tracking meter on your ebook reader to see exactly how far you’ve progressed in working your way through his entire life work.
有各种各样的动机想要拆分或合并您的藏书中的电子书。 也许您将大量的选集分解成小块,将诗歌集合并成一本书,或者为每本罗伯特·海因莱因书创建一个大的原版,这样您就可以使用电子书阅读器上的进度跟踪仪来准确地了解您在他一生的工作中都取得了进展。
Regardless of your motivation, today’s tutorial shows you how to merge and split the painless way without all the headache of mucking around in the guts of an ebook where you can easily wreck the markup language and render your book corrupt.
不管您的动机如何,今天的教程都向您展示了如何轻松地合并和拆分方式,而不会费解所有麻烦的电子书,在电子书中,您很容易破坏标记语言,并使您的书损坏。
我需要什么? (What Do I Need?)
For this tutorial you’ll need the following things:
对于本教程,您需要满足以下条件:
-
A copy of free ebook management software Calibre
免费的电子书管理软件Calibre的副本
-
The EpubMerge/Split Plugins
-
DRM-free ebooks, in ePub format, you wish to merge or split
您希望合并或拆分ePub格式的无DRM的电子书
First, although you don’t need to be intimately familiar with Calibre to follow along with our tutorial, it wouldn’t hurt to familiarize yourself with the application. Check out our introduction to Calibre here. For the purposes of this tutorial, we’re assuming you’ve already installed Calibre and added the books you wish to work with.
首先,尽管您不需要非常熟悉Calibre来了解我们的教程,但熟悉应用程序也不会有任何伤害。 在这里查看我们对口径的介绍。 就本教程而言,我们假设您已经安装了Caliber并添加了您希望使用的书籍。
Second, this technique relies on the structure of the ePub format. You can easily convert your books from another format into ePub format using Calibre (and then, when finished merging or splitting, convert them from ePub back to the original format). If the files you wish to work with are currently DRM-laden, you’ll need to strip the DRM before you begin manipulating them.
其次,该技术依赖于ePub格式的结构。 您可以使用Caliber轻松将书籍从其他格式转换为ePub格式(然后在完成合并或拆分后,将其从ePub转换回原始格式)。 如果您希望使用的文件当前装有DRM,则在开始对其进行操作之前,需要先剥离DRM 。
安装和配置插件 (Installing and Configuring the Plugins)
The heart of our workflow here, Calibre itself aside, is a pair of plugins contributed to the Calibre plugin database by JimmXinu. In order to use the plugins, we need to first install them. Within Calibre, navigate to the plugin menu by clicking Preferences ->Get plugins to enhance calibre, as seen in the screenshot above.
除了Calibre本身,这里工作流程的核心是JimmXinu为Caliber插件数据库贡献的一对插件。 为了使用插件,我们需要先安装它们。 在Calibre中,单击首选项->获取插件以增强口径,导航到插件菜单,如上面的屏幕快照所示。
The User Plugins menu is, by default, sorted by the date the plugin was added to/updated in the database. Click on the Plugin Name column to sort by name and make locating our two plugins easier. Once sorted by name, scroll down until you find EpubMerge and EpubSplit, like so:
默认情况下,“用户插件”菜单按插件添加到数据库/在数据库中更新的日期排序。 单击“插件名称”列以按名称排序,并使我们两个插件的查找更加容易。 按名称排序后,向下滚动直到找到EpubMerge和EpubSplit,如下所示:
Select one and then click the Install button. Click Yes when the security risk dialog box pops up. In the next step, the plugin installer will ask where you want links to the plugin to appear. By default, it will add a button to your main toolbar. Because we tend to work frequently from the context menu, we also added a context menu entry:
选择一个,然后单击“安装”按钮。 弹出安全风险对话框时,单击“是”。 在下一步中,插件安装程序将询问您要在何处显示该插件的链接。 默认情况下,它将在主工具栏中添加一个按钮。 因为我们倾向于从上下文菜单中频繁进行工作,所以我们还添加了一个上下文菜单项:
As noted at the bottom of the window, you can always go into Preferences -> Customize the toolbar to change these settings later. Once you’ve made your selection and hit OK here, it will remind you that the changes won’t take effect until you restart Calibre.
如窗口底部所述,您始终可以进入“偏好设置”->“自定义工具栏”以稍后更改这些设置。 做出选择并在此处单击“确定”后,它会提醒您更改将在重新启动Calibre之前生效。
Click OK instead of Restart as we need to install the second plugin. Repeat the exact same process for the second plugin. Double check that both EpubMerge and EpubSplit are installed. Restart Calibre.
单击确定,而不是重新启动,因为我们需要安装第二个插件。 对第二个插件重复完全相同的过程。 仔细检查是否同时安装了EpubMerge和EpubSplit。 重新启动口径。
After you’ve restarted Calibre, either right click to access your context menu or navigate to the main menu bar. EpubMerge has a few basic configuration options, whereas EpubSplit is configuration free. When you select Configure Plugin under EpubMerge, you’ll see the following options:
重新启动Calibre之后,右键单击以访问上下文菜单或导航至主菜单栏。 EpubMerge具有一些基本配置选项,而EpubSplit是免费配置。 在EpubMerge下选择配置插件时,您将看到以下选项:
This is the default configuration and, unless you have a pressing reason to do otherwise, we suggest leaving as it is. Preserving the Metadata makes it extremely easy to precisely reverse the merge at a later date if you need to return the documents to their original state.
这是默认配置,除非您迫切需要这样做,否则我们建议保留原样。 如果需要将文档恢复到原始状态,保留元数据将使在以后的日期中精确地撤消合并变得非常容易。
合并电子书 ( Merging Your Ebooks)
For the purposes of this tutorial, we’re going to create a mega anthology of Jane Austen’s novels and some supplementary material. In order to create your merge, you need to highlight all the ePub documents you wish to collect together and then, either using the context menu or the menu bar, select EpubMerge -> Merge Epubs.
出于本教程的目的,我们将创建简·奥斯丁小说的大型选集和一些补充材料。 为了创建您的合并,您需要突出显示您希望收集的所有ePub文档,然后使用上下文菜单或菜单栏选择EpubMerge-> Merge Epubs。
Note: If any of the documents you select are not ePubs or are DRM-protected ePubs, the process will fail immediately and you will be notified via popup window which documents caused the failure.
注意:如果您选择的任何文档不是ePub或不是受DRM保护的ePub,则该过程将立即失败,并且将通过弹出窗口通知您哪些文档导致了失败。
After selecting the documents and starting the merge, you’ll see the box shown in the screenshot above. By default, the ePubs are ordered as they appeared in Calibre. If you wish to rearrange them (in our case we arranged them by date of publication), you may use the green arrows on the righthand side to move them up, down, or (if you accidentally included an ePub file) remove them with the red X. When they are in the order you want, click OK.
选择文档并开始合并后,您将看到上面的屏幕快照中显示的框。 默认情况下,ePub的顺序与它们在Calibre中的显示顺序相同。 如果您希望重新排列它们(在我们的情况下,我们是按发布日期排列的),则可以使用右侧的绿色箭头上下移动它们,或者(如果不小心包含了ePub文件,请使用红色X。按所需顺序排列时,单击“确定”。
In the next stage, two things happen. First, Calibre creates a metadata entry for the merged document in the Calibre database. A box will pop up warning you that you must review the entry before the actual merged document is created. This entry automatically inherits the metadata of the first document in the merge list:
在下一阶段,将发生两件事。 首先,Caliber为Caliber数据库中的合并文档创建一个元数据条目。 将弹出一个框,警告您在创建实际的合并文档之前,您必须检查该条目。 此项自动继承合并列表中第一个文档的元数据:
In the case of our Jane Austen book merge, it inherited most of the metadata from her first book Sense and Sensibility (including the cover, title, author name, and if the book had been tagged in Calibre, the tags too). The comment metadata, usually where you would find a summary/review of the book, is replaced with a block of text generated by EpubMerge that lists the contents of the anthology. You can leave all this data as it is or take a moment to modify it (you can always modify it later by editing the merged document’s metadata in Calibre).
就我们的Jane Austen图书合并而言,它继承了她的第一本书Sense and Sensibility中的大部分元数据(包括封面,书名,作者姓名,如果这本书已在Calibre中进行了标记,则标签也是如此)。 注释元数据(通常会在其中找到书的摘要/评论)将由EpubMerge生成的列出文本选集内容的文本块替换。 您可以保留所有这些数据,也可以花点时间对其进行修改(您以后总是可以通过在Calibre中编辑合并文档的元数据来对其进行修改)。
After approving the metadata, the merge is begins:
批准元数据后,合并开始:
After the merge is complete, you’ll have a brand new entry in Calibre that contains the new metadata and the new ePub document. Let’s take a look at the ePub document to see how the structure of the pre-merge documents has been preserved:
合并完成后,您将在Caliber中拥有一个全新的条目,其中包含新的元数据和新的ePub文档。 让我们看一下ePub文档,以了解如何保留合并前文档的结构:
All the books are gathered together with the individual structures of each book preserved (right down to the volume/chapter division from the original novel). Not only that, but the structure is preserved when we convert to MOBI. Success!
所有的书籍都被收集在一起,并保留了每本书的各个结构(从原著小说一直到数量/章节划分)。 不仅如此,当我们转换为MOBI时,结构得以保留。 成功!
拆分电子书 (Splitting Your Ebooks)
When it comes time to split your ebooks, there is the ultra-super-easy way and the slightly trickier way. If you are splitting a book that you previously merged with EpubMerge (and you had the “Keep Unmerge Metadata” box checked in the plugin options), then it’s a snap to split the mega volume apart.
当需要拆分您的电子书时,有一种超级简单的方法,也有一些棘手的方法。 如果您要拆分先前与EpubMerge合并的图书(并且在插件选项中选中了“保持取消合并元数据”框),那么将大型书册拆分就很容易了。
In the case of our massive Jane Austen anthology, all we had to do to turn the mega volume back into the individual books was to right click on it and select EpubMerge -> UnMerge Epub. Afterwards, the plugin created a new entry for each distinct book, dumped the old metadata back into it, and placed the individual novel as an ePub in the directory. Thanks to the preserved metadata, it’s that easy.
就我们庞大的Jane Austen选集而言,我们要做的就是将超大容量的书重新变成单独的书,右键单击它,然后选择EpubMerge-> UnMerge Epub。 之后,该插件为每本不同的书创建一个新条目,将旧的元数据转储回去,并将单个小说作为ePub放置在目录中。 由于保留了元数据,因此很容易。
If you’re splitting a document that does not have the metadata preserved by the EpubMerge plugin (either because you have the feature turned off or the document wasn’t created by the plugin in the first place) you’ll need to get your hands a little dirtier. Let’s take a look at our Jane Austen anthology using the EpubSplit plugin. After selecting the anthology and clicking EpubSplit, we’re presented with a fairly messy look at the guts of the ePub:
如果您要拆分的文档中没有保留EpubMerge插件保留的元数据(要么是因为您关闭了功能,要么是文档最初不是由插件创建的),则需要动手操作有点脏。 让我们看看使用EpubSplit插件的Jane Austen选集。 选择选集并单击EpubSplit之后,我们会看到一个非常混乱的ePub外观:
There is no automatic way to split a document that isn’t tagged with the helpful unmerge data placed by the EpubMerge plugin, so we’ll have to do this by hand. In the case of this already merged anthology, we have two sets of information we can go off to guide our split. First, each separate document that was originally merged into the mega volume has a unique number identifier found in the HREF column (in the case of the first novel, Sense and Sensibility, every file belonging to that novel is tagged with the number 9781411433144).
没有自动的方法来拆分未用EpubMerge插件放置的有用的未合并数据标记的文档,因此我们必须手动执行此操作。 对于已经合并的选集,我们可以提供两组信息来指导我们的分裂。 首先,最初合并到大型卷中的每个单独的文档在HREF列中都有一个唯一的编号标识符(对于第一个小说,Sense and Sensibility,属于该小说的每个文件都标记有数字9781411433144)。
Alternatively, if we were working with a document that did not have clean demarcation via serial number between the different sections, we could look at the Table of Contents column to see where each portion (as marked via the ePubs table of contents structure) started and stopped. We could further confirm these points in the text by hovering over the list entry to preview a portion of the first page.
或者,如果我们正在使用的文档在不同部分之间没有通过***进行明确划分,则可以查看“目录”列以查看每个部分(通过ePubs内容结构表标记)的开始位置,以及停了我们可以通过将鼠标悬停在列表条目上以预览第一页的一部分来进一步确认文本中的这些点。
Either way, once we establish what we wanted to manually extract from the ePub, we then highlight just those entries and click New Book. You will receive a warning, just like you did with the Merge function, that indicates a new entry has been created in Calibre but will not be populated until you review the metadata:
无论哪种方式,一旦我们确定了要从ePub中手动提取的内容,我们都将仅突出显示这些条目并单击“ New Book”。 就像使用合并功能一样,您将收到一条警告,指示已在Calibre中创建了一个新条目,但在您查看元数据之前不会填充新条目:
Also like the merge process, the metadata is pulled from the original document (in this case, the anthology) and applied to the extracted document. In the absence of preserved metadata, you have to enter it manually (or use Calibre’s metadata scraping function) to properly populate the new documents metadata.
与合并过程一样,元数据也将从原始文档(在本例中为选集)中提取,并应用于提取的文档。 在没有保留的元数据的情况下,您必须手动输入(或使用Calibre的元数据抓取功能)以正确填充新文档的元数据。
Let’s take a peek at our freshly extracted book:
让我们来看看我们刚摘录的书:
The table of contents has survived the extraction process, as well as the formatting of the novel. Another success!
目录在提取过程以及小说的格式中均幸免于难。 另一个成功!
Have an ebook tip, trick, or technique of your own to share? Have an idea for an ebook-related tutorial? Join in the discussion below.
有自己的电子书提示,技巧或技巧可以共享吗? 有一个与电子书相关的教程的想法吗? 加入下面的讨论。
翻译自: https://www.howtogeek.com/168444/how-to-easily-merge-and-split-ebooks/
java 合并和拆分单元格