1. 程式人生 > 實用技巧 >java 合併和拆分單元格_如何輕鬆合併和拆分電子書

java 合併和拆分單元格_如何輕鬆合併和拆分電子書

java 合併和拆分單元格

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:

對於本教程,您需要滿足以下條件:

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 合併和拆分單元格