diff options
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 15 | ||||
-rw-r--r-- | sc/source/filter/excel/xestream.cxx | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 5a0045753612..4814bde09dfd 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -386,9 +386,18 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU m_Repr = aFileName; msTarget = XclXmlUtils::ToOUString( aLink ); - // ooxml expects the file:/// part appended ( or at least - // ms2007 does, ms2010 is more tolerant ) - msTarget = "file:///" + msTarget; + + if( bRel ) + { + for( int i = 0; i < nLevel; ++i ) + msTarget = "../" + msTarget; + } + else + { + // ooxml expects the file:/// part appended ( or at least + // ms2007 does, ms2010 is more tolerant ) + msTarget = "file:///" + msTarget; + } } else if( eProtocol != INetProtocol::NotValid ) { diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index e4ef28b4e4dd..52e4d5b34056 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -1060,6 +1060,10 @@ bool XclExpXmlStream::exportDocument() aData.maMaxPos.SetRow( ::std::min( aData.maScMaxPos.Row(), aData.maXclMaxPos.Row() ) ); aData.maMaxPos.SetTab( ::std::min( aData.maScMaxPos.Tab(), aData.maXclMaxPos.Tab() ) ); aData.mpCompileFormulaCxt.reset( new sc::CompileFormulaContext(&rDoc) ); + // set target path to get correct relative links to target document, not source + INetURLObject aPath(getFileUrl()); + aData.maBasePath = aPath.GetPath() + "\\"; + aData.maBasePath = "file:///" + aData.maBasePath.replace('\\', '/'); XclExpRoot aRoot( aData ); |