I was looking at that some time ago and did not find an easy way to achieve
this. Unfortunately this is something that is not supported easily by
XmlBeans as far as I saw (it might still be possible, I might just lack
knowledge of what XmlBeans can do, I did not look at it much at all yet).

I also think that duplicating the whole sheet has high probability of
introducing loads of other problems.


On Tue, Jul 10, 2018 at 9:40 PM, pj.fanning <fannin...@yahoo.com> wrote:

> I've been looking at
> https://github.com/apache/poi/blob/trunk/src/ooxml/
> testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java#L344
> The test fails with: java.lang.AssertionError: Row 3 (1-based) is not in
> ascending order; previously saw 5
> After shifting the xssf rows as part of the test, the underlying CTRows are
> not reordered.
> wb.getSheetAt(0).getCTWorksheet().getSheetData().getRowList()
> When the workbook is output, the rows in the output are out of order.
> XMLBeans doesn't seem to make it easy to fix this.
> I've tried to empty the rows on SheetData and to recreate them but this
> orphans the existing CTRows and leads to errors if I try to read off the
> data from the old rows when trying to create new ones.
> org.apache.xmlbeans.impl.values.XmlValueDisconnectedException
>         at
> org.apache.xmlbeans.impl.values.XmlObjectBase.check_
> orphaned(XmlObjectBase.java:1258)
>         at
> org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.
> CTRowImpl.getR(Unknown
> Source)
> It seems like the best solution to completely recreate the sheet by adding
> a
> new sheet, copying on all the items related to the initial sheet (with the
> rows shifted) and then removing the old sheet before then renaming the new
> sheet and putting in the right sheet order.
> This does seem like a lot of work and there are risks that even this
> approach won't work.
> Anyone have any thoughts on alternative solutions?
> --
> Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
> For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to