Have anyone tried to embed excel as an image object to a word document using coldfusion? I have found no reference or tutorial to the question above so far on the internet. My code as of now does nothing to embed and would like someone who can share a link related to the question. Quick reference:
<!-- strPath is cffile.serverFile of cffile action="upload" -->
<cfset strpa = session.yo.path />
<cfif not structKeyExists(session, "yo")>
<cflocation url="form.cfm" addToken="false">
</cfif>
<head>
</head>
<body>
<CFOUTPUT>
Excel Table: </br>
<cfspreadsheet action="read" src="#GetTempDirectory()##strpa#" query="Result"> <cfdump var="#Result#"></br>
TextLabel: #session.yo.text# </br>
<!-- Embed Excel as Image Object to Word Document here?-->
</CFOUTPUT>
<a class="word-export" href="javascript:void(0)">Save As doc for the web page with wordexport.js lib </a>
</div>
<script src="js/FileSaver.js"></script>
<script src="js/jquery.wordexport.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$("a.word-export").click(function(event) {
$("#page-content").wordExport();
});
});
</script>
</body>
Any help is much appreciated.
but the excel embedded in word document is not an image. It's a image
object to open the stored excel file
So your real goal is to embed an Excel file, not just an image of it, correct? If so, it is not possible with the plugin you are using. The reason is the plugin simply generates HTML code, which MS Word can interpret. You cannot embed Excel files within an HTML page. To embed a file, you need to generate a real Word document instead, which is not a trivial task.
If you are limited to HTML only, probably the closest you can get is to create a hyperlink to an Excel file. The link could point to a remote file on the server OR to a local file. For example, if you were to use <a href="ExcelFile.xls">, MS Word would attempt to open a file named "ExcelFile.xls", located in the same directory as your faux Word document.
Obviously that approach requires exporting both files. Since HTTP requests can only return a single mime type, you would need to create a zip file (containing both the HTML and Excel documents) and return the .zip file instead of .doc.
Related
I am trying to write an ejs file with a for-each loop that displays, as text, names of javascript variables line by line. I want each name to be hyperlinked to a route, such as /getinfo, that renders a page that displays more information about the variable that was clicked on.
I tried to use an "a href" tag as follows:
<a href="/getinfo?name=" <%= variable.name>> <%= variable.name %></a>
I expected variable.name to be included in the URL's query parameters, but it won't be appended properly. Considering how HTML does not support string concatenation, I am not sure how to properly include this data in an HTTP GET request.
What would be a correct way to achieve this? Thank you!
It's simple. Using template literal
<a href="<%= `/getinfo?name=${variable.name}${variable.name}` %>">
Regular ejs to output escaped html
<a href="/getinfo?name=<%= variable.name %><%= variable.name %>">
http://ideone.com/g9gdkK
According to the documentation, I have to change the hrefs and srcs to the URL form (after moving the files to static folder) and add {{include}} to the body, but the output is not proper.
<link href="css/bootstrap.min.css" rel="stylesheet">
to
<link href="{{=URL('static', 'css/bootstrap.min.css')}}" rel="stylesheet">
The original html code is in the link above.
Please help.
The file views/layout.html defines the overall structure of your site.
Find {{include}} - at this point the views (or the HTML code in your views) is included into the overall structure.
If you have a controller test and the function output as in http:\\www.whatever.com\test\output
def output():
# Do something
return dict(...)
Web2py is looking for a corresponding view output.html in views/test where you can do stuff with the returned contents (if you want to).
This HTML file might look like:
{{extend 'layout.html'}}
<div>
<!-- Your contents -->
</div>
More informations regarding this topic can be found in the page-layout section of the official documentation.
i want to create cascading drop down lookup list in sharepoint 2013. i want to take the data ,whatever i currently entered that data will be displayusing knockout js in sharepoint 2013.
so please give me some solution.
Thanks
Develop your knockout js code in separate javascript file and add that page reference to master page. Make sure to give correct path. Finally publish the master page. After publishing
your code will look like as follows.
<script type="text/javascript" src="parthtothefolder/knockout-3.0.0.js">//<![CDATA[
//]]>
</script>
<script src="parthtothefolder/yourfile.js">//<![CDATA[
//]]>
</script>
Add your html code to relevant location of the container.
It seems that when you copy something from a web browser to the clipboard, at least 2 things are stored:
Plain text
HTML source code
Then it is up to the software that you are pasting into can determine which one it wants.
When pasting into MS Excel 2003, you have a paste special option to paste HTML, which will paste the formatted HTML (as it is displayed by the browser).
What I want to do is paste the actual source code as plain text. Can this be fetched from the clipboard in VBA?
Edit I'm trying to access all the source-code of the copied HTML, including the tags.
This time I've read the question properly and realised coonj wants to get the HTML from the clipboard including tags.
I believe this is reasonably difficult. You need to read the clipboard using Windows API calls. And then, parse the resulting CF_HTML string which has some wacky headers added on top of the HTML.
Microsoft Knowledge Base article with Windows API code to read the CF_HTML from the clipboard (function GetHTMLClipboard).
You will then probably want to ignore the wacky headers. Microsoft documents the format here. An example CF_HTML fragment is shown below. You could probably come up with some guesswork method of skipping the first few lines.
Version:0.9
StartHTML:71
EndHTML:170
StartFragment:140
EndFragment:160
StartSelection:140
EndSelection:160
<!DOCTYPE>
<HTML>
<HEAD>
<TITLE>The HTML Clipboard</TITLE>
<BASE HREF="http://sample/specs">
</HEAD>
<BODY>
<!--StartFragment --> <P>The Fragment</P>
<!--EndFragment -->
</BODY>
</HTML>
It might also be worth thinking whether there's any other way of solving your problem. E,g, Will the browser always be Internet Explorer? Can you get what you need by walking the HTML tree using the COM object model?
EDIT: coonj has tried this now and says "the GetHTMLClipboard function seems to work with both Firefox and IE, and it doesn't look like it is throwing those headers in there"
VB6 has the Clipboard object that allows you to get the clipboard data in different formats. VBA doesn't have this object. But there are windows API calls you can use. You can see a sample implementation for VBA here.
We have a legacy ASP page that writes content to an excel file by generating client-side VB script based on data from the database. It uses set app = CreateObject("Excel.Application") to initialize Excel.
The problem is that this is an "unsigned activex control", and some clients are now saying they wont change their IE settings to make it work.
Apart from re-writing the page in ASP.NET using Aspose.Cells (which would take a long time for this page), I was wondering if anyone knows any other options that could help?
Thanks!
Although this thread refers to ASP.Net, a lot of it may be of interest to you:
Send query results to Excel from ASP.NET website
It mentions creating HTML output and modifying the headers to output to Excel. This may also be of interest http://support.microsoft.com/kb/199841
Here is a very simple example.
<%
Response.ContentType = "application/vnd.ms-excel"
%>
<TABLE>
<TR><TD>
<!-- Cell : A1 -->
2
</TD></TR>
<TR><TD>
<!-- Cell : A2 -->
3
</TD></TR>
<TR><TD>
<!-- Cell : A3 -->
=SUM(A1:A2)
</TD></TR>
</TABLE>
Thanks for the response. The problem is that the our spreadsheet generated has lots of additional functionality, e.g. setting up some "validation" for certain columns - the HTML solution would not be able to do this I think.
However - your answer forced me to take another look at the code, and it turns out simpler than I thought to do this using an "Excel Writer" like Aspose.Cells :)