Why Images are not attached in test spec (MS Word formnat)?
Moderators: Amaradana, TurboPT, TL Developers
Why Images are not attached in test spec (MS Word formnat)?
I have noticed no images are attached to test report or test spec documents, if they are generated in MS Word format. It works just fine in HTML format.
If it is a configuration issue, please provide steps to fix it.
Any help is much appreciated.
If it is a configuration issue, please provide steps to fix it.
Any help is much appreciated.
Re: Why Images are not attached in test spec (MS Word formna
Hi,
Please see following in the documentation, I got it working for me, following instruction in section 5.7.4.
Cheers.
========================================================
5.7.4. CKEditor custom configuration
CKEditor could be configured via settings in file: <testlink>/cfg/tl_fckeditor_config.js.
This file include toolbar definitions and options as described in the editor documentation: FCKeditor 2.x/Developers Guide/Configuration/Configuration Options
Paste from Open Office or other document editors
Consider the next option for default behaviour:
FCKConfig.ForcePasteAsPlainText = true ;
FCKConfig.AutoDetectPasteFromWord = true;
===============================================
Please see following in the documentation, I got it working for me, following instruction in section 5.7.4.
Cheers.
========================================================
5.7.4. CKEditor custom configuration
CKEditor could be configured via settings in file: <testlink>/cfg/tl_fckeditor_config.js.
This file include toolbar definitions and options as described in the editor documentation: FCKeditor 2.x/Developers Guide/Configuration/Configuration Options
Paste from Open Office or other document editors
Consider the next option for default behaviour:
FCKConfig.ForcePasteAsPlainText = true ;
FCKConfig.AutoDetectPasteFromWord = true;
===============================================
Re: Why Images are not attached in test spec (MS Word formna
Thanks for quick reply.
My problem is not attaching an image to a test case. The problem is that the generated test spec/report/plan documents do not have any of corresponding uploaded images, if the generated document is in MS Word format. The places that an image supposed to be (e.g. in summery of a test case) is blank with an error messaeg that says:
"The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location."
Uploading image by CKEditor is done and it can be displayed in HTML format of a generated document (e.g. Test Plan), but the image does not get downloaded and attached to the document, if it is in MS Word format.
My problem is not attaching an image to a test case. The problem is that the generated test spec/report/plan documents do not have any of corresponding uploaded images, if the generated document is in MS Word format. The places that an image supposed to be (e.g. in summery of a test case) is blank with an error messaeg that says:
"The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location."
Uploading image by CKEditor is done and it can be displayed in HTML format of a generated document (e.g. Test Plan), but the image does not get downloaded and attached to the document, if it is in MS Word format.
Re: Why Images are not attached in test spec (MS Word formna
Hi aostad,
I had tha same issue. I figured out that the problem is the path to the image (src="/path/to/image.jpg").
If it is (src="http://www.example.com/path/to/image.jpg") it is working in some Word Versions.
Following code snippet is able to add the domain name in front of images:
just paste this code snippet on line 292 in /TestLink_1.9.1/lib/results/printDocument.php
Hope it works on your Word version.
I know this solution is "quick and dirty" usually a new method / function should be added to /TestLink_1.9.1/lib/functions/print.inc.php and on line 292 of /TestLink_1.9.1/lib/results/printDocument.php this function should called. But this is also working and easier to add in to a new version. May be this poblem is going to be fixed in a future version.
Regards waver
I had tha same issue. I figured out that the problem is the path to the image (src="/path/to/image.jpg").
If it is (src="http://www.example.com/path/to/image.jpg") it is working in some Word Versions.
Following code snippet is able to add the domain name in front of images:
Code: Select all
####################################################################################
# change relative image paths to absolute image paths
# src="/ => src="http(s)://example.com/
####################################################################################
# fetch protocol and domainname
if($_SERVER["SERVER_PORT"]=='443'){
$url_host = "https://".$_SERVER["HTTP_HOST"];
}elseif($_SERVER["SERVER_PORT"]=='80'){
$url_host = "http://".$_SERVER["HTTP_HOST"];
}else{
$url_host = $_SERVER["HTTP_HOST"].":".$_SERVER["SERVER_PORT"];
}
if(substr($url_host, -1)!='/'){
$url_host.= '/';
}
$xPattern = "/src=\"\//si";
$xValue = "src=\"".$url_host;
$docText = preg_replace($xPattern, $xValue, $docText);
####################################################################################
Hope it works on your Word version.
I know this solution is "quick and dirty" usually a new method / function should be added to /TestLink_1.9.1/lib/functions/print.inc.php and on line 292 of /TestLink_1.9.1/lib/results/printDocument.php this function should called. But this is also working and easier to add in to a new version. May be this poblem is going to be fixed in a future version.
Regards waver
Re: Why Images are not attached in test spec (MS Word formna
Thanks a lot. You saved me a lot of time for copy/paste images.
I believe it is a bug and need to be looked at.
Cheers,
AO
I believe it is a bug and need to be looked at.
Cheers,
AO
Re: Why Images are not attached in test spec (MS Word formna
Which Version of Word are you using?
My Findings are:
- Word 2003 SP3 (Windows XP SP3) -> working fine
- Word 2004 (OSX 10.6) -> working very slow (until the image is in the visible area it start to load it 50kb - 1-2 min)
- Word 2008 (OSX 10.6) -> working very slow
Regards Waver
My Findings are:
- Word 2003 SP3 (Windows XP SP3) -> working fine
- Word 2004 (OSX 10.6) -> working very slow (until the image is in the visible area it start to load it 50kb - 1-2 min)
- Word 2008 (OSX 10.6) -> working very slow
Regards Waver
Re: Why Images are not attached in test spec (MS Word formna
I use Office 2007. It's pretty good and have not noticed any issue.
Re: Why Images are not attached in test spec (MS Word formna
Hi aostad,
Will this solution work for 1.8.5 ? We are using Word 2002 and facing similar issue?
thanks for help.
Will this solution work for 1.8.5 ? We are using Word 2002 and facing similar issue?
thanks for help.
Re: Why Images are not attached in test spec (MS Word formna
Hi sss,
it should work, but you have to replace $docText with $generatedText and insert it on line 249.
Before 250 $generatedText .= renderEof();
I've not tested on 1.8.5. please report if it is working.
Regards waver
it should work, but you have to replace $docText with $generatedText and insert it on line 249.
Before 250 $generatedText .= renderEof();
I've not tested on 1.8.5. please report if it is working.
Regards waver
Re: Why Images are not attached in test spec (MS Word formna
Thanks waver. After modifying as per your suggestion it is working fine.
Thanks again.
Regards,
sss
Thanks again.
Regards,
sss
Re: Why Images are not attached in test spec (MS Word formna
To prevent this issue FCKedit php connector configuration can be changed like this: http://mantis.testlink.org/view.php?id=4396
Re: Why Images are not attached in test spec (MS Word formna
I tried changing the fckeditor config but wasn't successfull .
While generating test plan report in word format, the company logo is missing. I tried giving absolute path but still a problem
Can some one help please
$output .= '<p style="text-align: center;"><img alt="TestLink logo" ' .
'title="configure using $tlCfg->document_generator->company_logo" height="53" '.
' src="https://server:88/testlink/s1/gui/theme ... ges/c1.png" />';
$output .= '<p style="text-align: left;"><img alt="TestLink logo" ' .
'title="configure using $tlCfg->document_generator->company_logo" height="900" '.
' src="' . $_SESSION['basehref'] . TL_THEME_IMG_DIR . 'c1.png' . '" />';
While generating test plan report in word format, the company logo is missing. I tried giving absolute path but still a problem
Can some one help please
$output .= '<p style="text-align: center;"><img alt="TestLink logo" ' .
'title="configure using $tlCfg->document_generator->company_logo" height="53" '.
' src="https://server:88/testlink/s1/gui/theme ... ges/c1.png" />';
$output .= '<p style="text-align: left;"><img alt="TestLink logo" ' .
'title="configure using $tlCfg->document_generator->company_logo" height="900" '.
' src="' . $_SESSION['basehref'] . TL_THEME_IMG_DIR . 'c1.png' . '" />';