This is going to sound very pedantic I know so forgive me please but you have
set your break on column 6 so you will see a break there. Are you saying
that you are seeing two breaks defined on a single column in that view or
are you saying that you are seeing a number of page breaks off to the left
of the one you inserted? Also, are you talking about the Page Break Preview
or a Print Preview?

Having asked you those questions, I have to admit that I do not know off of
the top of my head just what the answer could be. I think it might have
something to do, simply, with the way Excel builds it's views and it may not
be something that you can control but I cannot say this with any confidence.
However, I did my usual trick which was to open a new sheet in Excel, type
data into the first row of columns A to R, set a break at column E and then
click on the Page Break Preview button. Excel showed me breaks at columns E
and N and appeared to show one at column R but I think that this last break
only appeared as that column was the last one containing data. Is this what
you are seeing, a break to the right of the final column that holds data?
What happens if you perform a print preview instead of the page break
preview? I would expect that manipuating the HSSFPrintSetup object will have
more of an impact on that rather than the page break preview.

Also, remember that you have control over exactly how and where the data is
moved to now; you could always move part of the original sheet to a
different location or even onto an additional sheet in order to get the
exact layout you are after. It may pay you to go back to 'the start' so to
speak, to look at the presentation you are after and then think of the
easiest way to accomplish this. Now, as you are able to move data around on
the sheets, do you need to set column breaks or even hide columns as we did
initially for example?

Do not know if that helps at all, I seem to be suggesting abandoning some of
the work you have already done. It may help to start a new thread for this
further question as you suggest; that may encourage others to look again if
they are not following this discussion already. Having said that though, I
still think we are talking about that same 'sort' of problem so would be
inclined to continue with this thread.

Yours

Mark B



dgv123 wrote:
> 
> Thanks Mark. I used your code(modified) to copy data within the same
> sheet.
> It worked fine.
> 
> Another issue i am having now is with respect to page breaks.
> I do a sheet.setColumnBreak((short)7); but then when i do a 
> page break preview on Excel, I see my defined page break and 
> also one on column 6(dotted). I tried doing a 
> 
> HSSFPrintSetup ps = sheet.getPrintSetup();
> ps.setFitWidth((short)1);
> 
> but that didnt help. Have you encountered the same error before?
> 
> Maybe I should post this question as a new post..not sure.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/POI-%28Excel%29-usage-questions.-tp24116860p24179718.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to