I have a website that I have developed that has a note editor. The user is able to export the note into a word document for storage. I also have an AngularJs table that has real time log information for a product. At any time the user can export an Excel file to save all the data in the table. In the most likely use case between the user and the notepad, the user will want the data from the AngularJs table appended at the end to the the exported word document.
I have support for exporting only the notes into a word document as shown below:
In HTML:
<script>
function downloadInnerHtml(elId) {
var d = new Date();
var dd = d.getDate();
var mm = d.getMonth() + 1;
var yyyy = d.getFullYear();
if (dd < 10) {
dd = '0' + dd
}
if (mm < 10) {
mm = '0' + mm
}
var hr = d.getHours();
var min = d.getMinutes();
if (min < 10) {
min = "0" + min;
}
var filename = 'note.html'
var elHtml = document.getElementById(elId).innerHTML;
var converted = htmlDocx.asBlob(elHtml);
saveAs(converted, yyyy + '-' + mm + '-' + dd + 'T' + hr + min + '_note.docx');
}
</script>
I also have support for exporting the AngularJs table by itself into an Excel document as shown below:
In HTML:
<button type="submit" class="btn btn-success" ng-click="exportData()">Export Table</button>
In AngularJs:
$scope.exportData = function () {
var blob = new Blob([document.getElementById('export').innerHTML], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
var d = new Date();
var dd = d.getDate();
var mm = d.getMonth() +1;
var yyyy = d.getFullYear();
if(dd<10){
dd='0'+dd
}
if(mm<10){
mm='0'+mm
}
var hr = d.getHours();
var min = d.getMinutes();
if (min < 10) {
min = "0" + min;
}
saveAs(blob, yyyy+'-'+mm+'-'+dd+'T'+hr+min+"_Report.xls");
};
I am using this library for reference: http://ift.tt/1gBCJ02
Does anyone know how I could achieve the concatenation of the AngularJs Table to the end of the exported word document?
Aucun commentaire:
Enregistrer un commentaire