function GetListType() {
if (documenteditor.selection.paragraphFormat.listId !== -1) {
// Unicode for Dot Bullet
var dotBullet = '\uf0b7';
// Unicode for Circle Bullet
var circleBullet = '\uf06f' + '\u0020';
// Unicode for Square Bullet
var squareBullet = '\uf0a7';
// Unicode for Flower Bullet
var flowerBullet = '\uf076';
// Unicode for Arrow Bullet
var arrowBullet = '\uf0d8';
// Unicode for Tick Bullet
var tickBullet = '\uf0fc';
var listText = documenteditor.selection.paragraphFormat.listText;
if (listText == dotBullet || listText == circleBullet || listText == squareBullet ||listText == flowerBullet || listText == arrowBullet || listText == tickBullet) {
return "Bulleted list";
} else {
return "Numbered list";
}
} else {
return "Cursor not in list";
}
} |
documenteditor.saveAsBlob('Sfdt').then(function (blob) {
var fileName = 'sample.json';
if (navigator.msSaveBlob) {
navigator.msSaveBlob(blob, fileName);
} else {
var downloadAnchorTag: any = document.createElementNS('http://www.w3.org/1999/xhtml','a');
if ('download' in downloadAnchorTag) {
downloadAnchorTag.download = fileName;
var dataUrl: string = window.URL.createObjectURL(blob);
downloadAnchorTag.rel='nofollow' href = dataUrl;
var event: MouseEvent = document.createEvent('MouseEvent');
event.initEvent('click', true, true);
downloadAnchorTag.dispatchEvent(event);
setTimeout((): void => {
window.URL.revokeObjectURL(dataUrl);
dataUrl = undefined;
});
} else {
var extension = fileName.substring(fileName.indexOf('.') + 1);
if (extension !== 'docx' && extension !== 'xlsx') {
let url: string = window.URL.createObjectURL(blob);
let isPopupBlocked: Window = window.open(url, '_blank');
if (!isPopupBlocked) {
window.location.rel='nofollow' href = url;
}
} else {
let reader: FileReader = new FileReader();
reader.onloadend = () => {
let isPopupBlocked: Window = window.open(reader.result as string, '_blank');
if (!isPopupBlocked) {
window.location.rel='nofollow' href = reader.result as string;
}
}
reader.readAsDataURL(blob);
}
}
}
})
|