Version: 1.3.2 (using KDE KDE 3.3.0) OS: Linux Every cell shares it's borders with the surrounding cells. Often when I try to change the style of one of the borders of a specific cell, it fails because the adjacent cell also has it's own style setting for that border. So, I need to go to the adjacent cell and change the same border there as well. This isn't a very comfortable way of working with cell borders. Users can easily get the impression that KSpread behaviour is buggy. Maybe adjacent cells should share one definition of the style of their shared borders in stead of each cell having it's own definition.
*** Bug 124230 has been marked as a duplicate of this bug. ***
*** Bug 65100 has been marked as a duplicate of this bug. ***
I don't agree that the severity is only set to "minor". I tried to make a timetable with nice borders, but soon gave up after too much frustration with the borders and used OO for the task. I saw many rendering bugs and such, which I believe is the result of two adjacent cells sharing a different border style. Like the original reporter said, please handle adjacent borders like one border, like OpenOffice does.
SVN commit 696417 by nikolaus: Commands Style. Unset the borders of the adjacent cells, if a outer border is set. The undo does not work properly yet; redo does though. CCBUG: 87371 M +41 -1 StyleCommand.cpp --- trunk/koffice/kspread/commands/StyleCommand.cpp #696416:696417 @@ -51,8 +51,12 @@ { if ( m_firstrun ) { + const QRect rect = range.adjusted(m_style->hasAttribute(Style::LeftPen) ? -1 : 0, + m_style->hasAttribute(Style::TopPen) ? -1 : 0, + m_style->hasAttribute(Style::RightPen) ? 1 : 0, + m_style->hasAttribute(Style::BottomPen) ? 1 : 0); const QList< QPair<QRectF,SharedSubStyle> > rawUndoData - = m_sheet->styleStorage()->undoData( Region(element->rect()) ); + = m_sheet->styleStorage()->undoData( Region(rect) ); for ( int i = 0; i < rawUndoData.count(); ++i ) { // if ( m_style->hasAttribute( rawUndoData[i].second->type() ) || @@ -115,6 +119,15 @@ style.setLeftBorderPen( leftPen ); m_sheet->cellStorage()->setStyle( Region(QRect(range.left(), range.top(), 1, range.height())), style ); m_style->setLeftBorderPen(leftPen); // restore pen + // reset the border of the adjacent cell + if (range.left() > 1) + { + Style tmpStyle; + tmpStyle.setRightBorderPen(QPen(Qt::NoPen)); + const Region region(QRect(range.left() - 1, range.top(), 1, range.height())); + m_sheet->cellStorage()->setStyle(region, tmpStyle); + m_sheet->setRegionPaintDirty(region); + } } if ( rightPen.style() != Qt::NoPen ) { @@ -122,6 +135,15 @@ style.setRightBorderPen( rightPen ); m_sheet->cellStorage()->setStyle( Region(QRect(range.right(), range.top(), 1, range.height())), style ); m_style->setRightBorderPen(rightPen); // restore pen + // reset the border of the adjacent cell + if (range.right() < KS_colMax) + { + Style tmpStyle; + tmpStyle.setLeftBorderPen(QPen(Qt::NoPen)); + const Region region(QRect(range.right() + 1, range.top(), 1, range.height())); + m_sheet->cellStorage()->setStyle(region, tmpStyle); + m_sheet->setRegionPaintDirty(region); + } } if ( topPen.style() != Qt::NoPen ) { @@ -129,6 +151,15 @@ style.setTopBorderPen( topPen ); m_sheet->cellStorage()->setStyle( Region(QRect(range.left(), range.top(), range.width(), 1)), style ); m_style->setTopBorderPen(topPen); // restore pen + // reset the border of the adjacent cell + if (range.top() > 1) + { + Style tmpStyle; + tmpStyle.setBottomBorderPen(QPen(Qt::NoPen)); + const Region region(QRect(range.left(), range.top() - 1, range.width(), 1)); + m_sheet->cellStorage()->setStyle(region, tmpStyle); + m_sheet->setRegionPaintDirty(region); + } } if ( bottomPen.style() != Qt::NoPen ) { @@ -136,6 +167,15 @@ style.setBottomBorderPen( bottomPen ); m_sheet->cellStorage()->setStyle( Region(QRect(range.left(), range.bottom(), range.width(), 1)), style ); m_style->setBottomBorderPen(bottomPen); // restore pen + // reset the border of the adjacent cell + if (range.bottom() < KS_rowMax) + { + Style tmpStyle; + tmpStyle.setTopBorderPen(QPen(Qt::NoPen)); + const Region region(QRect(range.left(), range.bottom() + 1, range.width(), 1)); + m_sheet->cellStorage()->setStyle(region, tmpStyle); + m_sheet->setRegionPaintDirty(region); + } } } return true;
I wonder, if the calculation of the border value could be replaced since the new style storage. Check!
I can't triage this bug because removing borders currently doesn't work on trunk r876221.
Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved.