Why are there empty lines after my shape in Word? - ms-word

This question is related (follows from) this question.
I am dynamically generating Word documents from data in a database. In the generation I need to have the First Page of a section have a different top margin than the other pages in the section. For reason that would take too long to explain properly, I can't just create a new section with a different top margin.
To get around my problem I thought I would create a shape (rectangle) with no border and no fill (invisible) that was the height I wanted my margin to be. I would then place it absolutely at (0,0). I would also make it wrapTopAndBottom so that it pushed the text in the body of the page down. This is working... except for one small problem.
As you can see there is a large, blank area immediately after my shape. There are actual blank lines there. You can see the lines better in this image where I've put text in those lines.
When I look at the header xml file in the Word archive, those lines don't exist. I'm not sure where they are coming from or how to get rid of them. I can manually remove them using Word but every time I regenerate the file they get put back in there. If someone knows why this is happening and / or how to get around it, I'd appreciate the help.
Thanks.

I finally figured this out.
Sorry I couldn't post code up here. First, I'm not using C#, I'm using PHP. Second, the amount of code I'd have to post to show how the header is getting created is prohibitive on a forum like this. Third, I'm not really allowed to post the company's code up here.
In any case, the problem was simple once I saw it. We are placing multiple absolutely positioned objects (shapes, text, images, whatnot) inside the header. In the class that creates these objects each one was being placed inside a <w:p> element. For example, if there were 3 such objects, the XML looked like this.
<hdr>
<p>Some Object</p>
<p>Some Object</p>
<p>Some Object</p>
</hdr>
The problem is that even though each of the objects inside the <p> are absolutely positioned, the <p> element itself creates a line and space for that line. So the header above would have 3 blank lines in it. This became an issue if the header had 6 or 7 objects because the blank lines would push the header's margin down and force the page's content down as well. This was undesired behavior.
The solution is simple. All the absolutely positioned objects can be placed in the same <p> element. This leaves only 1 blank line in the header no matter how many objects you have.

Related

Tips of making a list in email

I am designing an email template. I have a running list of brand names hyperlinked to their websites. I would like it to be displayed inline for full-width, and stacked for narrow screens. I had separators in the past like a bullet or a vertical rule such as this: "|". But in mobile it's awkward considering only one name appears per line.
The next thing I tried was to enclose each list item in a border, but Outlook10/13 aren't handling the padding and margin as you know. I want a simple solution that I can show to novices when they populate the template. Any ideas? I'm adding screenshots of what I tried with the borders. But any other idea is welcome.
Thanks!!!
Full Width:
Mobile:
I have tried a lot of ways myself and one thing i found out was having logos in place of links often work better. I know images have to be downloaded but once they are downloaded it looks good. If you do go with images, you can style the alt tags to look like above when its not loaded.

Microsoft-Word: hide overflow in a table-cell

I have a Word-File in which I'm going to add content programmatically.
The content is going to be added into table-cells and thats where the problem starts:
The Word-File looks like this
The cell where it now says "000000873588" is the one being filled by my application. This is working fine until someone enters a string thats too large like so:
The text is being broken down onto the next line which leads to my document actually adding a second page at the end because the whole content doesn't fit anymore.
Now I know the easiest way would be to already truncate the string in the application itself, but this would require me to know the exact cell-size of each cell in the document, which I don't as I have 12 different document-templates that are all being filled programmatically.
Is Word able to set a table-cell to a fixed size and then just cut off the overflow? I can't really imagine it not being able to. I did quite some research but the only thing I found was keeping cells together over page-breaks which is not what I need.

RDLC Export to Word Showing a blank extra page

Im using RDLC for VS 2010 and exporting the graph to a word document gives one extra blank page (its not showing in PDF though). All of the dimensions in Report, Chart and Body are set 11x8.5 with no margins. I just wonder what could be causing the blank page in Word.
I was having the exact same problem and managed to solve it by adjusting the layout of my report.
Basically I moved all of my rectangles/tables etc to sit tightly next to each other, eliminating any white space where possible and also resized the report to be as small as possible, i.e. sit tightly against its contents.
It might also be worth enabling the report option to 'ConsumeContainerWhitespace'.
I suspect Word uses its own pagination logic, which is why you see a difference between pdf and doc. So it may just be the case that your report is over-running very slightly into the next page and saving a little space on the report may prevent this.
I realise this is not a precise answer, but I hope it helps nonetheless.

iReport issue with lists and whitespace

I've had this issue bothering me for quite some time now.
When I leave whitespace underneath a list, the list will push this downwards, instead of overwriting it.
Sometimes while doing so, pushing content onto the next page !
I've tried to illustrate the situation - see attached.
In the first image, the chart at the bottom left has position type "float", hence it's positioned underneath the whitespace.
When I change it to "relative to top", it's positioned at the correct place, but still the whitespace will be present underneath it (between the chart and the footer)
Can this be solved, and how?!
It's a real problem when trying to get a decent layout.
Thanks in advance.
That's just how JasperReports is. You designed the report with whitespace in it, so the report keeps it there.
In many cases (and I suspect that includes this case) you can get what you want by simply making the List component object bigger. In effect will set its minimum size to match the chart to its right. It can stretch further, but it won't force any whitespace to be added into the rendered report.

Printing Crystal Report detail section to second page collated

I have a Crystal XI Release 2 report that my client wants to see on two pages. He wants the report to print the demographic information such as (name, address, etc...) for a person on the first page and the totals for the person need to print on the second page. The first page will include as many rows as will fit and the second page will have the same amount of rows which correspond one for one to the first page. Then the third page will contain a new page of people starting where the first ended.
He basically is looking for printing similar to how Excel prints (and please don't tell me to Export to Excel and print from there).
I came up with two ideas for doing this, but only got anywhere with one. The first was to run two reports (one for the demographic info and the other for the totals) which would be collated together somehow. I didn't get very far with this, but I didn't spend a ton of time researching this so I still think this could be an option.
The second way was to extend the report design to the width of two landscape pages, add my fields, and then change my page size back to a single landscape size before I get ready to print. This way sorta works, but can cause some weird issues. One is that if you try to edit/add a field on the second page when the report size is set to a single page landscape the fields are moved to the far right of the first page which makes sense because I would think that is supposed to be the editable region of the designer so I'd assume you're not supposed to have fields outside of this region.
All in all, the second way works, but I know there has to be a better way to do this. I wanted to see if anyone has had a similar request or have some other ideas on a better way to do this. Thanks
I can't think of an easy way to do this in Crystal.
You could get all hacky on the datasource and duplicate every 20(or however many fit on one page) rows. Then you would set up 2 details sections, one section for demographics and the other for totals. Then conditionally suppress them depending on remainder(pagenumber, 2).
Or you could use a subreport that accepts paging parameters and only returns 20 rows per page. But I'm not even sure if you can link a subreport parameter to the pagenumber special field.
How does your second way work? The extra fields just get printed on the next page somehow? However, the problem is that the fields stay outside the designer when you go back to one page and if you need to edit they all move back inside the designer? Couldn't you increase the page width before editing? That's not too bad if it somehow prints it out correctly every time.
I guess I will mark this as the answer since I still haven't been able to figure out a better way around it. If anyone finds a better way then post a response and if it works I think can toggle the answer.
What I do to get around this is to set my printer to the "Microsoft Office Document Image Writer" and then change the width to the widest it will allow which is 36". Then I put the demographic information from the beginning of the section to around 11" and put the totals stating just to the right of where the first section ended and go for another page width.
Then I make whatever changes that I need to make and set the printer back to the printer I want to use for the correct size. After you do this you will find that the editable area only extends to the first page, but you can see the second page of fields to the right. If you try to edit a field on the second page the field will move to the far right of the editable region which is at the far right of the first page so make sure you reset your printer before making edits.
I think I also had to play around with the width of the detail section on the layout tab of the section expert to get the report to print correctly. I set it to the combined size of the 2 pages for mine to look correct.
I think that this is probably a super rare issue, but if you are having a similar issue, that is how I get around it.