package com.rongwei.sfcommon.utils;

import com.aspose.cells.License;
import org.springframework.stereotype.Component;

import java.io.InputStream;

/**
 * AsposeWordsUtils class
 *
 * @author XH
 * @date 2022/08/01
 */
@Component
public class AsposeWordsUtils {
    public static boolean getExcelLicense() {
        boolean result = false;
        try {
            InputStream is = AsposeWordsUtils.class.getClassLoader().getResourceAsStream("license.xml");
            License aposeLic = new License();
            aposeLic.setLicense(is);
            result = true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }

    public static boolean getWordLicense() {
        boolean result = false;
        try {
            InputStream is = AsposeWordsUtils.class.getClassLoader().getResourceAsStream("license.xml");
            com.aspose.words.License aposeLic = new com.aspose.words.License();
            aposeLic.setLicense(is);
            result = true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }

}
