We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

List type & export sfdt

1. How to get ListType when the cursor is in list. I wan't to find out whether it is bulleted list or numbered list

2. When I export a document it always appends .sfdt to the filename. Is there way to override this.

Thanks for all the help, you guys rock

1 Reply

RT Ramya Thirugnanam Syncfusion Team February 18, 2019 09:31 AM UTC

Hi Sampurnima,  
Thank you for contacting Syncfusion support.  
Regarding “get ListType when the cursor is in list”  
In our DocumentEditor control, we can get selected list type by using ‘listText’ property in SelectionParagraphFormat class.   
Sample Code  
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";  
Regarding “appends .sfdt to the filename. Is there way to override this?”  
In our DocumentEditor control, if you export a document as SFDT format ‘.sfdt’ extension will append to the filename to denote the that file is in SFDT format. So, it not possible to override this default behavior of ‘save method of Document Editor.  
So, we suggest you use ‘saveAsBlob which return the document content as ‘Blob’ and it can be downloaded in to client machine with custom name by using below code.  
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);  
        setTimeout((): void => {  
            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;  
Note: SFDT denotes ‘Syncfusion Document Text’ which is our internal structure to load and export the content from DocumentEditor.  
Ramya T 

Live Chat Icon For mobile
Up arrow icon