Bug 36874 solved the problem for 80% of the label forms (the most frequently used labels). In the case of other 20% (mostly non-symmetrical label forms and label forms with one row or one column) the paper size cannot be calculated from the current label definition. Therefore the label definition will be enhanced with paper size. Also the UI of the Label Document wizard can be improved.
Initial summary of wishes for UI-improvement: tab Dimensions): -paper size should be shown; -horizontal and vertical distance are irrelevant and confusing for users with 1 column respectively row. These distance(s) should be disabled with 1 column or 1 row; -graphic should ideally show label form with all labels on form. Explanation of the term (hor/vert distance, left/top margin, label width/heigth, paper width/height could perhaps be done bij coloured marking instead of dimension lines plus text (current situation).
status report: Of all labels definitions in Labels.xcu (approx. 1400), more than 1150 are single sheet label forms and 235 are continuous forms. There are 240 label definitions of which the paper-format is yet to be checked/corrected, most of which are continuous forms. Though slowly, the work progresses. The git diff file is twice as large (1.2MB) as the Labels.xcu itself (0.55MB). I don't know what will be the best way to submit this... On the coding side, the paper definitions in Labels.xcu are used when creating now label documents. This works well with lots of different labels. The UI is waiting for the Labels.xcu to be completed. Apart from the label document wizard, there is also a business card wizard, which uses (a lot of) the same code and the same label definitions. I still have to find the difference between the two, as I cannot change one without changing the other as well.
status report: Labels.xcu has been converted. Some obsolete labels have been removed and the layout is now consistent in the whole file. I have also include a simple legend. Some label definitions produce a distorted document (not all labels fit on the paper). This is caused by 2 factors: -rounding errors in the MM100 to TWIP conversion can make that the last frame of a row or column does not fit on the page. I intend to reduce the label width/heigth with 1 TWIP if (leftmargin + ncols*labelwidth + (ncols-1)*hor.labelgap) respectively (uppermargin + nrows*labelheight + (nrows-1)*vert.labelgap) exceeds tha paper width repsectively height. -an ancient fix(24446, pre 1996) sets borders with respect to unprintable areas on the paper. However, there are lots of labelforms that have labels from edge of paper to edge of paper, i.e. with part of the label in unprintable area. I intend to remove this piece of code. Once this is done and tested, I want to proceed with the UI. The paper size must be visible and edit-able.
Created attachment 56292 [details] patch wihout UI-modification (so not yet complete) diff file contains the patch without the UI-modifications, which have to be done yet. The patch works (still some cases to be tested), also when reading a old custom label definition (i.e. without paper width/height). The problems described in bug 35104 and bug 41755 are solved. The code from fix 24446 seems to have no effect on the document, neither positive, nor negative. I have not removed this code as the exact meaning is not completely clear to me.
Created attachment 56658 [details] patch sofar, still dirty and not yet complete The attached diff file seems to work for (almost) all LibreOffice labels, but there are still some special cases where the created document differs from the label form as it should be.
Created attachment 56660 [details] screendump of modified label dialog (format tab) I had to add two new texts (Page Width and Page Height) to the dialog. I don't know how to handle the multi-lingual aspects of these two new texts.
Created attachment 56789 [details] patch improved label/BC wizard The patch. Changes made: -added page width and page height to label definitions, as the definitions were not complete (page size could not be determined from definitions). Removed some obsolete label definitions after consulting the manufacturer. Also added a legend (should anyone wish to add new current label defintions) and made layout consistent throughout the file (Labels.xcu); -added page width and page size to label wizard and business card wizard and label dimension dialog (all files); -added conversion of old-style custom label definitions (labelcfg.cxx); -improved frame calculation - because of rounding off, situations were possible for the labels not to fit on the paper (e.g. 3 labels 70mm wide on a row of A4 paper (210mm wide)resulted in 3 frames of 3969TWIPs (totals 11907TWIPs) on a paper onlt 11906TWIPs wide (applab.cxx); -improved frame space handling - the gaps between labels are right/lower spaces of the frame, so that frames can be put on the document next to each other when creating the document. However, when the gap between labels is larger than the right/lower margin of the page, the labels will not fit on the page. I removed the right space for the right colum of labels and the lower space for the bottom row of labels. I used 4 different drames for this as I could not make it work with one frame and changing left/lower space attribute. (applab.cxx); -removed fix24445 as i could not determine any positive effect of this code (applab.cxx).
Thank you for this, pushed :-) You are the Labels maintainer, so I only basically checked that, and corrected few tabs to spaces, otherwise looked good to me, thank you! http://cgit.freedesktop.org/libreoffice/core/commit/?id=80a72c4cc7edc6b4c0b88d841500617cd733cbf7
committed patch does not behave as tested. -gaps between labels seem not present when creating a new document.
fix for submitted patch submitted. Attempt to rearrange some lines of code had resulted in unwanted behaviour...
Winfried Donkers committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=a99083d233d0d5c5a09941ec2ee7164bc63c61db fdo#44516 final fix for labels with gaps larger than page margin
chance to backport this for 3.5.x as well? http://ask.libreoffice.org/question/137/35-shows-avery-file-labels-as-a-single-column-not
Summary of changes made: The changes have to do with the addition of page width and height to label definitions and with the creation of a writer document with frames representing labels or business cards. -the majority of the changes (let's say 98%) regards the addition of members lPWidth and lPHeight to class SwLabItem. The label definition file (Labels.xcu) has had all labels changed and various cxx files have the member added for assigning values to class instances; There is one special case in labelcfg.cxx (lines 120-126) which addresses the possibility that a non-converted (no page width/height defined) is read. -the page width/height is also shown in the dialog, straightforward code including setting minimum and maximum values that can be entered. -There are cases where the summed width of the frames exceeds the page width (same for height). Example: an A4 sheet with 3 labels 70mm wide produces a frame width of 3969 twips (total width 3 x 3969 = 11907) whereas the page is only 11906twips wide. In applab.cxx, iResultWidth, iResultHeight, iWidth, iHeight compensate for this. -Finally there is the case where the horizontal gap between labels is larger than the right margin (same for height). The document is created with frames that have right and lower spaces representing the horizontal/vertical gap. The last frame of the column/row will not fit on the row/column if the right/lower page margin is not big enough. To solve that, I use different frames for the right column and for the bottom row. (applab.cxx, pFmtOERow, pFmtEOCol, pFmtEOColEORow).
*** Bug 47316 has been marked as a duplicate of this bug. ***
Created attachment 58543 [details] diff file of Labels.xcu - content changes only To simplify reviewing the patch for pushing it to 3.5 branch, I have done some editing with vi on both the 'old' and the 'new' Labels.xcu: -remove all leading spaces (:%s/ \{1,\}//g); -insert linefeed between '><' (:%s/></>\r</g); -remove empty lines (:%s/\n\{2,\}/\r/g) I made a diff file (diff -a -b), which now shows only changes in contents.
(In reply to comment #15) > -remove all leading spaces (:%s/ \{1,\}//g); should have been: -remove all leading spaces (:%s/ \{1,\}<//g); (only spaces before any xml-labels, not spaces in text) This was typing error in the comment, not in the editing.
Winfried Donkers committed a patch related to this issue. It has been pushed to "libreoffice-3-5": http://cgit.freedesktop.org/libreoffice/core/commit/?id=716f0e2c10ab958a8ce4c22e78d726ac13491f5b&g=libreoffice-3-5 fdo#44516: Improved label/BC wizard - set paper size It will be available in LibreOffice 3.5.3.
*** Bug 47165 has been marked as a duplicate of this bug. ***