easy-excel复杂格式

2023-11-08

1.支持easy-excel模板与不同列表循环打印,合并表头,背景色;

2.支持excel的高度自适应

3. 支持多sheet页面模板打印;

代码如下

    @Test
    public void compositeFill1() {
        // 模板注意 用{} 来表示你要用的变量 如果本来就有"{","}" 特殊字符 用"\{","\}"代替
        // {} 代表普通变量 {.} 代表是list的变量 {前缀.} 前缀可以区分不同的list
        String templateFileName =
            TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator
                + "composite_2.xlsx";

        String fileName =
            TestFileUtil.getPath() + "compositeFill" + System.currentTimeMillis() + ".xlsx";
        ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build();
//        WriteSheet writeSheet = EasyExcel.writerSheet().build();
        FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL)
            .build();

        excelWriter.write(Collections.singletonList(new TargetHeader()), EasyExcel.writerSheet().head(TargetHeader.class)
            .needHead(Boolean.FALSE)
            .build());
        clear(excelWriter);
        excelWriter.write(Collections.singletonList(new TargetData()),
            EasyExcel.writerSheet().head(TargetData.class).needHead(Boolean.FALSE)
                .build(),
            EasyExcel.writerTable(1).needHead(Boolean.FALSE).build());
        clear(excelWriter);

        WriteSheet writeSheet2 = EasyExcel.writerSheet().needHead(Boolean.FALSE)
            .head(QuestionHeader.class)
            .build();
        excelWriter.write(Collections.singletonList(new QuestionHeader()), writeSheet2);
        clear(excelWriter);
        excelWriter.write(asList(new QuestionData(),new QuestionData(),new QuestionData(),new QuestionData()), EasyExcel.writerSheet().needHead(Boolean.FALSE)
            .head(QuestionData.class)
            .build());
//        excelWriter.finish();

        clear(excelWriter);

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("name", "河南利丰机构");
        excelWriter.fill(map, EasyExcel.writerSheet().build());
        excelWriter.finish();
        // 别忘记关闭流
    }


    //清空easy-excel缓存的样式
    private void clear(ExcelWriter excelWriter) {
        excelWriter.writeContext().writeWorkbookHolder().getHasBeenInitializedSheetIndexMap()
            .clear();
        excelWriter.writeContext().writeWorkbookHolder().getHasBeenInitializedSheetNameMap()
            .clear();
//        excelWriter.writeContext().writeWorkbookHolder().writeHandlerMap().clear();
    }
package com.alibaba.easyexcel.test.temp;

import static org.apache.poi.ss.usermodel.BorderStyle.THIN;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentLoopMerge;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import lombok.Data;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

/**
 * @author Jiaju Zhuang
 */
@Data
@ContentStyle( borderRight = THIN,borderLeft =  THIN, borderTop = THIN, borderBottom = THIN, fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 1, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
@ContentRowHeight(45)
public class QuestionData {

    //    @ContentLoopMerge(eachRow = 1, columnExtend = 1)
    @ExcelProperty(index = 0)
    private String no = "1";

    @ContentLoopMerge(eachRow = 1, columnExtend = 4)
    @ExcelProperty(index = 1)
    @ContentStyle(  borderTop = THIN, borderBottom = THIN, fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 1, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
    private String path = "企业股权结构和实际控制人情况";
    @ContentLoopMerge(eachRow = 1, columnExtend = 9)
    @ExcelProperty(index = 5)
    private String content = "是否存在控股股东和如有,请说明具体情况。";
    @ExcelProperty(index = 14)
    private String flag = "";

    @ExcelProperty(index = 2)
    private String p2;
    @ExcelProperty(index = 3)
    private String p3;
    @ExcelProperty(index = 4)
    private String p4;
    @ExcelProperty(index = 6)
    private String p6;
    @ExcelProperty(index = 7)
    private String p7;
    @ExcelProperty(index = 8)
    private String p8;
    @ExcelProperty(index = 9)
    private String p9;
    @ExcelProperty(index = 10)
    private String p10;
    @ExcelProperty(index = 11)
    private String p11;
    @ExcelProperty(index = 12)
    private String p12;
    @ExcelProperty(index = 13)
    private String p13;

}
package com.alibaba.easyexcel.test.temp;

import static org.apache.poi.ss.usermodel.BorderStyle.THIN;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentLoopMerge;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.Data;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

/**
 * @author Jiaju Zhuang
 */
@Data
@HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 11, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
// 头背景设置成红色 IndexedColors.RED.getIndex()
//@HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 10)
// 头字体设置成20
// 内容的背景设置成绿色 IndexedColors.GREEN.getIndex()
//@ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 11, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
@ContentRowHeight(30)
@ContentFontStyle(bold=true,fontHeightInPoints = 11)
@ContentStyle( borderRight = THIN,borderLeft =  THIN, borderTop = THIN, borderBottom = THIN, fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 1, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
public class QuestionHeader {

    //    @ContentLoopMerge(eachRow = 1, columnExtend = 1)
    @ExcelProperty(index = 0)
    private String no = "序号";
    @ContentLoopMerge(eachRow = 1, columnExtend = 4)
    @ExcelProperty(index = 1)
    private String path = "问题目录";
    @ContentLoopMerge(eachRow = 1, columnExtend = 9)
    @ExcelProperty(index = 5)
    private String content = "计划开始时间";
    @ExcelProperty(index = 14)
    private String flag = "标记";

    @ExcelProperty(index = 2)
    private String p2;
    @ExcelProperty(index = 3)
    private String p3;
    @ExcelProperty(index = 4)
    private String p4;
    @ExcelProperty(index = 6)
    private String p6;
    @ExcelProperty(index = 7)
    private String p7;
    @ExcelProperty(index = 8)
    private String p8;
    @ExcelProperty(index = 9)
    private String p9;
    @ExcelProperty(index = 10)
    private String p10;
    @ExcelProperty(index = 11)
    private String p11;
    @ExcelProperty(index = 12)
    private String p12;
    @ExcelProperty(index = 13)
    private String p13;
}

package com.alibaba.easyexcel.test.temp;

import static org.apache.poi.ss.usermodel.BorderStyle.THIN;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentLoopMerge;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import lombok.Data;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

/**
 * @author Jiaju Zhuang
 */
@Data
@ContentRowHeight(30)
@ContentStyle( borderRight = THIN,borderLeft =  THIN,   borderTop = THIN, borderBottom = THIN, fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 1, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
public class TargetData {

    @ContentLoopMerge(eachRow = 1, columnExtend = 7)
    @ExcelProperty(index = 0)
    private String name1 = "厦门天下好发发发发发反反复复好工作有限公司";
    @ContentLoopMerge(eachRow = 1, columnExtend = 4)
    @ExcelProperty(index = 7)
    private String people1 = "张三丰 ";
    @ContentLoopMerge(eachRow = 1, columnExtend = 4)
    @ExcelProperty(index = 11)
    private String data1 = "2020/2/12";


    @ExcelProperty(index = 1)
    private String p1;
    @ExcelProperty(index = 2)
    private String p2;
    @ExcelProperty(index = 3)
    private String p3;
    @ExcelProperty(index = 4)
    private String p4;
    @ExcelProperty(index = 5)
    private String p5;
    @ExcelProperty(index = 6)
    private String p6;
    @ExcelProperty(index = 8)
    private String p8;
    @ExcelProperty(index = 9)
    private String p9;
    @ExcelProperty(index = 10)
    private String p10;
    @ExcelProperty(index = 12)
    private String p12;
    @ExcelProperty(index = 13)
    private String p13;
    @ExcelProperty(index = 14)
    private String p14;
}
package com.alibaba.easyexcel.test.temp;

import static org.apache.poi.ss.usermodel.BorderStyle.THIN;
import static org.apache.poi.ss.usermodel.IndexedColors.YELLOW;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentLoopMerge;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.Data;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

/**
 * @author Jiaju Zhuang
 */
@Data
//@HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 11, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
// 头背景设置成红色 IndexedColors.RED.getIndex()
//@HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 10)
// 内容的背景设置成绿色 IndexedColors.GREEN.getIndex()
//@ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 11, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
// 内容字体设置成20
@ContentFontStyle(bold=true,fontHeightInPoints = 11)
//@ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 11, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true)
@ContentStyle( borderRight = THIN,borderLeft =  THIN,  borderTop = THIN, borderBottom = THIN, fillPatternType = FillPatternType.SOLID_FOREGROUND,
    fillForegroundColor = 1, horizontalAlignment = HorizontalAlignment.CENTER, wrapped = true )
@ContentRowHeight(25)
public class TargetHeader {

    @ContentLoopMerge(eachRow = 1, columnExtend = 7)
    @ExcelProperty(index = 0)
    private String name = "对象名称";
    @ContentLoopMerge(eachRow = 1, columnExtend = 4)
    @ExcelProperty(index = 7)
    private String people = "人员";
    @ContentLoopMerge(eachRow = 1, columnExtend = 4)
    @ExcelProperty(index = 11)
    private String data = "计划开始时间";


    @ExcelProperty(index = 1)
    private String p1;
    @ExcelProperty(index = 2)
    private String p2;
    @ExcelProperty(index = 3)
    private String p3;
    @ExcelProperty(index = 4)
    private String p4;
    @ExcelProperty(index = 5)
    private String p5;
    @ExcelProperty(index = 6)
    private String p6;
    @ExcelProperty(index = 8)
    private String p8;
    @ExcelProperty(index = 9)
    private String p9;
    @ExcelProperty(index = 10)
    private String p10;
    @ExcelProperty(index = 12)
    private String p12;
    @ExcelProperty(index = 13)
    private String p13;
    @ExcelProperty(index = 14)
    private String p14;
}

模板图片

打印效果 

第二部分:一个模板打印到多sheet页面

利用poi复制sheet的模板

public InputStream generateTemplate(int sheetNum, String sheetName) {
    log.info("sheetNum {}", sheetNum);
    InputStream inputStreamTemplate =
        this.getClass().getClassLoader().getResourceAsStream("static/questionExport.xlsx");
    XSSFWorkbook workbook = null;
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try {
      workbook = new XSSFWorkbook(inputStreamTemplate);
      workbook.setSheetName(0, sheetName + "1");
      for (int i = 1; i < sheetNum ; i++) {
        //复制模板,得到第i个sheet
        int num = i + 1;
        workbook.cloneSheet(0, sheetName + num);
      }
      workbook.write(bos);
      byte[] bArray = bos.toByteArray();
      InputStream is = new ByteArrayInputStream(bArray);
      return is;
    } catch (Exception e ) {
      log.error(e.getMessage(), e);
      throw new ServiceException("模板生成错误", "模板生成错误");
    }
  }

    

   InputStream inputStreamTemplate =  generateTemplate(projectIdList.size(), sheetNameFmt);
    ExcelWriter excelWriter = EasyExcel.write(outputStream)     
        .withTemplate(inputStreamTemplate).build();
      WriteSheet writeSheet = EasyExcel.writerSheet().sheetName(sheetName).build();
      excelWriter.fill(exportProjectVo, writeSheet);
      excelWriter.finish();

3. 高度自适应

1.重新修改 easy-excel的AbstractRowHeightStyleStrategy的方法的

protected abstract void setContentColumnHeight(Row row, int relativeRowIndex);

protected abstract void setContentColumnHeight(Row row, Integer relativeRowIndex);

调试时候,发现使用模板的时候不改这个方法在有使用模板的时候回报类型转换错误;

2.自适应代码

    ExcelWriter excelWriter = EasyExcel.write(outputStream)
        .registerWriteHandler(new CustomCellWriteHeightConfig())
        .withTemplate(inputStreamTemplate).build();
package com.xmsme.ddi.excel;

import com.alibaba.excel.write.style.row.AbstractRowHeightStyleStrategy;
import java.util.Iterator;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;

/***
 * excel高度自适应
 */
@Slf4j
public class CustomCellWriteHeightConfig extends AbstractRowHeightStyleStrategy {
  /** 默认高度 */
  private static final Integer DEFAULT_HEIGHT = 300;

  public static int GetMergeNum(Cell cell, Sheet sheet) {
    int mergeSize = 1;
    List<CellRangeAddress> mergedRegions = sheet.getMergedRegions();
    for (CellRangeAddress cellRangeAddress : mergedRegions) {
      if (cellRangeAddress.isInRange(cell)) {
        // 获取合并的行数
        mergeSize = cellRangeAddress.getLastColumn() - cellRangeAddress.getFirstColumn() + 1;
        // 获取合并的列数
        // mergeSize =	cellRangeAddress.getFirstRow()-cellRangeAddress.getLastRow()+1;
        break;
      }
    }
    return mergeSize;
  }

  @Override
  protected void setHeadColumnHeight(Row row, Integer relativeRowIndex) {}

  @Override
  protected void setContentColumnHeight(Row row1, Integer relativeRowIndex) {

    if (relativeRowIndex != null) {
      handleRow(row1, row1);
      return;
    }
    Iterator<Row> rowIterator = row1.getSheet().rowIterator();

    while (rowIterator.hasNext()) {
      Row row = rowIterator.next();
      handleRow(row1, row);
    }
  }

  private void handleRow(Row row1, Row row) {
    Iterator<Cell> cellIterator = row.cellIterator();

    if (!cellIterator.hasNext()) {
      return;
    }
    // 默认为 1行高度
    Integer maxHeight = 1;
    while (cellIterator.hasNext()) {
      Cell cell = cellIterator.next();
      switch (cell.getCellTypeEnum()) {
        case STRING:
          int width = row1.getSheet().getColumnWidth(cell.getColumnIndex());

          int widthSize = Double.valueOf(GetMergeNum(cell, row.getSheet()) * 2.5).intValue();
          //            log.info(
          //                "{} {} {} {} {} {}",
          //                cell.getAddress(),
          //                cell.getRowIndex(),
          //                cell.getColumnIndex(),
          //                cell.getStringCellValue(),
          //                GetMergeNum(cell, row.getSheet()),
          //                row1.getSheet().getColumnWidth(cell.getColumnIndex()));
//          log.info(
//              "{} widthSize=>{} length => {}",
//              cell.getStringCellValue(),
//              widthSize,
//              cell.getStringCellValue().length() / widthSize);
          if (cell.getStringCellValue().length() > widthSize && widthSize != 0) {
            int modValue = cell.getStringCellValue().length() % widthSize;
            int length =
                modValue == 0
                    ? cell.getStringCellValue().length() / widthSize
                    : cell.getStringCellValue().length() / widthSize + 1;
            maxHeight = Math.max(maxHeight, length);
          }
          break;
        default:
          break;
      }
    }
    short targetHeight = (short) (maxHeight * DEFAULT_HEIGHT);
    short height = row.getHeight();
//    log.info("targetHeight {} => {}", targetHeight, height);
    if (targetHeight > height) {
      row.setHeight(targetHeight);
    }
  }
}

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

easy-excel复杂格式 的相关文章

  • 无法在 Android 10 中创建目录

    我无法在 android 10 中创建目录 它可以在 android Oreo 之前的设备上运行 我尝试了两种创建文件夹的方法 Using File mkdir File f new File Environment getExternal
  • “_加载小部件时出现问题”消息

    加载小部件时 如果找不到资源或其他内容 则会显示 加载小部件时出现问题 就这样 惊人的 此消息保留在主屏幕上 甚至没有说明加载时遇到问题的小部件 我通过反复试验弄清楚了这一点 但我想知道发生这种情况时是否有任何地方可以找到错误消息 Andr
  • Android 2.2 SDK - Droid X 相机活动无法正常完成

    我注意到我在 Droid X 上调用的默认相机活动与我的 Droid 和 Nexus One 上的默认相机活动看起来不同 在 Droid 和 Nexus One 上选择 确定 后 活动将完成 Droid X 有一个 完成 按钮 它将带您返回
  • 对话框上的 EditText 不返回任何文本

    我太累了 找不到错误 我没有发现任何错误 但我没有从 editText 收到任何文本 请看下面的代码 活动密码 xml
  • 无法使用maven编译java项目

    我正在尝试在 java 16 0 1 上使用 maven 构建 IntelliJ 项目 但它无法编译我的项目 尽管 IntelliJ 能够成功完成 在此之前 我使用maven编译了一个java 15项目 但我决定将所有内容更新到16 0 1
  • eclipse中导入项目文件夹图标

    我在 Eclipse 工作区中新导入的 Maven 项目有J and M项目文件夹顶部的图标 项目和包资源管理器 而其他导入的 Maven 项目只有一个J icon 有人可以解释其中的区别吗 该项目有J装饰器被称为 Java 项目和具有M装
  • 使用 RecyclerView 适配器在运行时更改布局屏幕

    我有两个布局文件 如下所示 如果列表中存在数据 则我显示此布局 当列表为空时 我会显示此布局 现在我想在运行时更改布局 当用户从列表中删除最后一项时 我想将布局更改为第二张图片中显示的 空购物车布局 In getItemCount Recy
  • 主线程如何在该线程之前运行?

    我有以下代码 public class Derived implements Runnable private int num public synchronized void setA int num try Thread sleep 1
  • 如何获取 WebElement 的父级[重复]

    这个问题在这里已经有答案了 我试过了 private WebElement getParent final WebElement webElement return webElement findElement By xpath 但我得到
  • 列表应该如何转换为具体的实现?

    假设我正在使用一个我不知道源代码的库 它有一个返回列表的方法 如下所示 public List
  • 如何将 Jfreechart(饼图)添加到 netbeans 的面板中

    我正在使用 netbeans gui 编辑器 并且正在尝试添加一个本身位于内部框架中的 Jfreechart 并且这个内部框架我想将其添加到面板中 正如您在此图中看到的那样 抱歉 我无法直接发布图像 因为我新手 http www flick
  • Java 收集返回顶级项目的映射的嵌套流

    我有以下模型 class Item String name List
  • Espresso 和 Proguard 的 Java.lang.NoClassDefFoundError

    我对 Espresso 不太有经验 但我终于成功地运行了它 我有一个应用程序需要通过 Proguard 缩小才能处于 56K 方法之下 该应用程序以 3 秒的动画开始 因此我需要等到该动画结束才能继续 这就是我尝试用该方法做的事情waitF
  • 逃离的正确方法是什么?使用 Oracle 12c MATCH_RECOGNIZE 时 JDBCPreparedStatement 中的字符?

    以下查询在 Oracle 12c 中是正确的 SELECT FROM dual MATCH RECOGNIZE MEASURES a dummy AS dummy PATTERN a DEFINE a AS 1 1 但它不能通过 JDBC
  • 尝试使用等于“是”或“否”的字符串变量重新启动 do-while 循环

    计算行程距离的非常简单的程序 一周前刚刚开始 我有这个循环用于解决真或假问题 但我希望它适用于简单的 是 或 否 我为此分配的字符串是答案 public class Main public static void main String a
  • 对象锁定私有类成员 - 最佳实践? (爪哇)

    I asked 类似的问题 https stackoverflow com questions 10548066 multiple object locks in java前几天 但对回复不满意 主要是因为我提供的代码存在一些人们关注的问题
  • 如何在Java中正确删除数组[重复]

    这个问题在这里已经有答案了 我刚接触 Java 4 天 从我搜索过的教程来看 讲师们花费了大量精力来解释如何分配二维数组 例如 如下所示 Foo fooArray new Foo 2 3 但我还没有找到任何解释如何删除它们的信息 从内存的情
  • 挂钩 Eclipse 构建过程吗?

    我希望在 Eclipse 中按下构建按钮时能够运行一个简单的 Java 程序 目前 当我单击 构建 时 它会运行一些 JRebel 日志记录代码 我有一个程序可以解析 JRebel 日志文件并将统计信息存储在数据库中 是否可以编写一个插件或
  • 哪个集合更适合存储多维数组中的数据?

    我有一个multi dimensional array of string 我愿意将其转换为某种集合类型 以便我可以根据自己的意愿添加 删除和插入元素 在数组中 我无法删除特定位置的元素 我需要这样的集合 我可以在其中删除特定位置的数据 也
  • Java &= 运算符应用 & 或 && 吗?

    Assuming boolean a false 我想知道是否这样做 a b 相当于 a a b logical AND a is false hence b is not evaluated 或者另一方面 这意味着 a a b Bitwi

随机推荐

  • Hexo + GitHub 搭建个人博客(二) Hexo monie主题

    前言 hexo theme monie 卡片化设计 安装 Git 安装 在项目的根目录下执行 git clone https gitee com lyboy6 hexo themes monie git themes monie npm 安
  • STM32NVIC中断优先级管理

    目录 抢占优先级响应优先级区别 中断设置相关寄存器 IO unit8 t IP 240 中断优先级控制寄存器组 中断参数初始化函数NVIC Init NVIC InitTypeDef结构体 抢占优先级响应优先级区别 抢占优先级高的可以打断正
  • 常用的LaTeX公式用法

    常用的LaTeX公式用法 常用的latex公式用法 常用的latex公式用法 加法 效果 减法 效果 乘法 叉乘 times 例子 a b a times b a b 效果 a b 乘法 点乘 cdot
  • 本地Linux服务器安装宝塔面板,并内网穿透实现公网远程登录

    文章目录 前言 1 安装宝塔 2 安装cpolar内网穿透 3 远程访问宝塔 4 固定http地址 5 配置二级子域名 6 测试访问二级子域名 转发自CSDN远程穿透的文章 Linux安装宝塔 并实现公网远程登录宝塔面板 内网穿透 前言 宝
  • MySQL数据库基本操作-DQL

    文章目录 一 基本查询 二 运算符 2 1 算术运算符 2 2 位运算符和逻辑运算符 2 3 比较运算符 三 排序查询 四 聚合查询 4 1 聚合查询举例 4 2 NULL值处理 五 分组查询 六 分页查询 七 INSERT INTO SE
  • ONES CTO

    2021年4月24日 4月26日 华为开发者大会在深圳大学城举办 本次大会主题为 每一个开发者都了不起 来自华为及各行业的技术大咖们与开发者汇聚一堂 探讨最新 ICT 技术在行业的深度创新与最佳实践 ONES CTO 冯斌先生受邀出席大会
  • 打开页面js自动加载的方法

    一 js方法 1 在body标签加onload属性 例 2 window onload方法 例 二 jQuery方法 1 window onload function alert 自动加载 2 document ready function
  • 全国计算机等级考试题库二级C操作题100套(第95套)

    第95套 给定程序中 函数fun的功能是 计算N N矩阵的主对角线元素和反向对角线元素之和 并作为函数值返回 注意 要求先累加主对角线元素中的值 然后累加反向对角线元素中的值 例如 若N 3 有下列矩阵 1 2 3 4 5 6 7 8 9
  • C++常量

    C 常量 常量是固定值 在程序执行期间不会改变 这些固定的值 又叫做字面量 常量可以是任何的基本数据类型 可分为整型数字 浮点数字 字符 字符串和布尔值 常量就像是常规的变量 只不过常量的值在定义后不能进行修改 整数常量 整数常量可以是十进
  • android webview 加载https

    在设置的WebViewClient 接收所有信任证书 wv setWebViewClient new WebViewClient Override public void onReceivedSslError WebView view Ss
  • 利用mysqldump实现分库分表备份的shell脚本

    一 信息摘要 linux版本 CentOS 7 9 mysql版本 MySQL 5 7 36 脚本实现功能 利用mysqldump工具实现对mysql中的数据库分库备份 和对所备份数据库中的表分表备份 二 shell脚本 bin bash
  • tensorflow的gpu版本错误

    出现错误 E tensorflow stream executor cuda cuda event cc 48 Error polling for event status failed to query event CUDA ERROR
  • statsmodels笔记:绘制ACF和PACF

    理论部分见 算法笔记 ARIMA UQI LIUWJ的博客 CSDN博客 3 1 3 2 1 绘制自相关函数ACF from statsmodels graphics tsaplots import plot acf plot acf df
  • Pytroch 模型权重初始化

    目录 1 概念 2 权值初始化方法 2 1 常数初始化 2 2 均匀分布初始化 2 3 正态分布初始化 2 4 Xavier 均匀分布 2 5 Xavier 正态分布 2 6 kaiming 均匀分布 2 7 kaiming 正态分布 2
  • 在产品中,我们常说的A端/B端/C端是什么?

    一 引言 在IT产品中 我们常常把各类型的技术系统分为A端 B端 C端 那它们到底是什么呢 又是有什么区别呢 今天小郭就带大家来仔细看看 二 我们常说的A端 B端 C端 R端是什么 2 1 产品分类 IT产品大致可以分为这四个类型 A端 是
  • 大数据数据仓库建设流程概述

    数据仓库的逻辑分层架构 想看懂数据仓库的逻辑分层架构 必须先弄懂以下4大概念 数据源 数据来源 互联网公司的数据来源随着公司的规模扩张而呈递增趋势 同时自不同的业务源 比如埋点采集 客户上报 API等 ODS层 数据仓库源头系统的数据表通常
  • html加载页面转圈圈怎么打,js实现等待加载“转圈圈”效果

    完美实现加载转圈圈效果 js代码 function showLoading show if show document getElementById over style display block document getElementB
  • MA35D1测试-记录

    1 查看拨码开关的启动设定 找到开发板 拨码快关 复位按键 电源开关的位置 2 三根线和软件 一根5V 2A电源适配线 两根usb线 三根线 一根5V 2A电源适配线 两根usb线 电源线插上 确保可以波动开关 有灯 点亮 usb线 在有电
  • 关键词提取(keyword extraction)技术

    目录 1 统计方法 Statistical Method 1 1 TF 1 2 TFIDF 1 3 YAKE 2 图方法 Graph Based Approaches 2 1 PageRank 2 2 TextRank 2 2 Single
  • easy-excel复杂格式

    1 支持easy excel模板与不同列表循环打印 合并表头 背景色 2 支持excel的高度自适应 3 支持多sheet页面模板打印 代码如下 Test public void compositeFill1 模板注意 用 来表示你要用的变