当前位置: 首页 > news >正文

深圳做自适应网站设计如何做企业产品推广

深圳做自适应网站设计,如何做企业产品推广,网站建设怎么让百度搜索到,网站建设 网站设计文章目录 Tabulate - C表格格式化库介绍与使用主要特性安装方法使用vcpkg安装使用CMake集成直接包含头文件 基本使用示例高级功能单元格合并颜色和样式自定义边框样式从Markdown创建表格 实际应用示例数据库查询结果显示 注意事项 Tabulate - C表格格式化库介绍与使用 Tabulat…

文章目录

  • Tabulate - C++表格格式化库介绍与使用
    • 主要特性
    • 安装方法
      • 使用vcpkg安装
      • 使用CMake集成
      • 直接包含头文件
    • 基本使用示例
    • 高级功能
      • 单元格合并
      • 颜色和样式
      • 自定义边框样式
      • 从Markdown创建表格
    • 实际应用示例
      • 数据库查询结果显示
    • 注意事项

Tabulate - C++表格格式化库介绍与使用

Tabulate 是一个用于在终端中创建美观表格的现代C++库。它允许你以简单直观的方式创建和格式化表格,支持跨平台使用(Windows/Linux/macOS)。

主要特性

  • 简单易用的API
  • 支持多行单元格内容
  • 文本对齐(左、中、右)
  • 边框样式自定义
  • 单元格合并
  • 颜色和文本样式
  • 支持UTF-8字符
  • 无外部依赖

安装方法

使用vcpkg安装

vcpkg install tabulate

使用CMake集成

find_package(tabulate CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE tabulate::tabulate)

直接包含头文件

Tabulate是header-only的,可以直接下载头文件使用。

基本使用示例

#include <tabulate/table.hpp>
using namespace tabulate;int main() {Table table;// 添加表头table.add_row({"ID", "Name", "Age", "Salary"});// 添加数据行table.add_row({"1", "John Doe", "30", "$85,000"});table.add_row({"2", "Jane Smith", "28", "$92,500"});table.add_row({"3", "Bob Johnson", "35", "$78,300"});// 设置表格格式table.format().font_style({FontStyle::bold})  // 表头加粗.border_top("=").border_bottom("=").border_left("|").border_right("|").corner("+");// 设置列格式table.column(0).format().width(5);  // ID列宽度table.column(1).format().width(15); // Name列宽度table.column(2).format().width(8).font_align(FontAlign::center); // Age列居中table.column(3).format().width(10).font_align(FontAlign::right); // Salary列右对齐// 打印表格std::cout << table << std::endl;return 0;
}

高级功能

单元格合并

Table movies;
movies.add_row({"Movie", "Rating", "Year"});
movies.add_row({"The Shawshank Redemption", "9.3", "1994"});
movies.add_row({"The Godfather", "9.2", "1972"});// 合并第一行的前两列
movies[0][0].format().column_span(2);

颜色和样式

Table colorful_table;
colorful_table.add_row({"Red", "Green", "Blue"});// 设置单元格颜色
colorful_table[0][0].format().font_color(Color::red).font_style({FontStyle::bold, FontStyle::underline});colorful_table[0][1].format().font_background_color(Color::green).font_color(Color::white);colorful_table[0][2].format().font_color(Color::blue).font_style({FontStyle::italic});

自定义边框样式

Table custom_border;
custom_border.add_row({"A", "B", "C"});
custom_border.add_row({"1", "2", "3"});custom_border.format().border_top("-").border_bottom("-").border_left("|").border_right("|").corner("+");

从Markdown创建表格

auto table = Table::from_markdown("| Name | Age |\n|------|-----|\n| John | 25  |\n| Jane | 30  |");

实际应用示例

数据库查询结果显示

void display_query_results(const std::vector<Employee>& employees) {Table results;// 添加表头results.add_row({"ID", "Name", "Department", "Hire Date", "Salary"});// 添加数据for (const auto& emp : employees) {results.add_row({std::to_string(emp.id),emp.name,emp.department,emp.hire_date,"$" + std::to_string(emp.salary)});}// 格式化results.format().font_style({FontStyle::bold}).border_top("-").border_bottom("-").border_left("|").border_right("|").corner("+");// 列对齐和宽度results.column(0).format().width(5).font_align(FontAlign::center);results.column(3).format().width(12);results.column(4).format().width(10).font_align(FontAlign::right);std::cout << results << std::endl;
}

注意事项

  1. Tabulate 主要用于终端显示,不适合生成HTML或其它格式的表格
  2. 对于非常大的表格,性能可能不是最优的
  3. 某些复杂格式在窄终端中可能显示不正常

Tabulate 是一个功能强大且易于使用的库,特别适合需要在命令行界面中展示结构化数据的C++应用程序。它的API设计直观,支持丰富的格式化选项,可以创建出专业美观的表格输出。


文章转载自:
http://chozrim.sxnf.com.cn
http://calvinist.sxnf.com.cn
http://acerb.sxnf.com.cn
http://areopagitica.sxnf.com.cn
http://amoroso.sxnf.com.cn
http://ceratin.sxnf.com.cn
http://cheesed.sxnf.com.cn
http://anasarca.sxnf.com.cn
http://boottree.sxnf.com.cn
http://bellhop.sxnf.com.cn
http://categorise.sxnf.com.cn
http://centennial.sxnf.com.cn
http://blacksnake.sxnf.com.cn
http://appeasable.sxnf.com.cn
http://barbiturate.sxnf.com.cn
http://butterfly.sxnf.com.cn
http://christhood.sxnf.com.cn
http://andalusia.sxnf.com.cn
http://abridged.sxnf.com.cn
http://accadian.sxnf.com.cn
http://breeks.sxnf.com.cn
http://buttonhold.sxnf.com.cn
http://beachbound.sxnf.com.cn
http://beatle.sxnf.com.cn
http://balky.sxnf.com.cn
http://babouche.sxnf.com.cn
http://aerobatic.sxnf.com.cn
http://basan.sxnf.com.cn
http://antimonic.sxnf.com.cn
http://chield.sxnf.com.cn
http://arthritic.sxnf.com.cn
http://aphanitism.sxnf.com.cn
http://arrhythmically.sxnf.com.cn
http://blastomycetes.sxnf.com.cn
http://cardiganshire.sxnf.com.cn
http://bavarian.sxnf.com.cn
http://agitation.sxnf.com.cn
http://bimillennial.sxnf.com.cn
http://chilean.sxnf.com.cn
http://abortion.sxnf.com.cn
http://cabinetmaker.sxnf.com.cn
http://arles.sxnf.com.cn
http://asteroidal.sxnf.com.cn
http://buttlegger.sxnf.com.cn
http://chancellory.sxnf.com.cn
http://aspherics.sxnf.com.cn
http://anal.sxnf.com.cn
http://blowhole.sxnf.com.cn
http://banderilla.sxnf.com.cn
http://acheb.sxnf.com.cn
http://actinochitin.sxnf.com.cn
http://aristotelean.sxnf.com.cn
http://atomist.sxnf.com.cn
http://characin.sxnf.com.cn
http://alingual.sxnf.com.cn
http://apo.sxnf.com.cn
http://anisotropism.sxnf.com.cn
http://chinaberry.sxnf.com.cn
http://allred.sxnf.com.cn
http://cholecalciferol.sxnf.com.cn
http://aomen.sxnf.com.cn
http://bicentennial.sxnf.com.cn
http://amorism.sxnf.com.cn
http://antifoulant.sxnf.com.cn
http://ceroma.sxnf.com.cn
http://bireme.sxnf.com.cn
http://bacterioscopy.sxnf.com.cn
http://catfacing.sxnf.com.cn
http://cagy.sxnf.com.cn
http://almsfolk.sxnf.com.cn
http://cacao.sxnf.com.cn
http://adjutantship.sxnf.com.cn
http://bookrack.sxnf.com.cn
http://basophilous.sxnf.com.cn
http://arbitrable.sxnf.com.cn
http://absorbency.sxnf.com.cn
http://auscultatory.sxnf.com.cn
http://alveoli.sxnf.com.cn
http://autostability.sxnf.com.cn
http://breakfront.sxnf.com.cn
http://bragger.sxnf.com.cn
http://blacksploitation.sxnf.com.cn
http://calling.sxnf.com.cn
http://apogamous.sxnf.com.cn
http://albumenize.sxnf.com.cn
http://azoic.sxnf.com.cn
http://behaviour.sxnf.com.cn
http://cataclysm.sxnf.com.cn
http://arabica.sxnf.com.cn
http://amtract.sxnf.com.cn
http://anomaly.sxnf.com.cn
http://basicity.sxnf.com.cn
http://astral.sxnf.com.cn
http://alcidine.sxnf.com.cn
http://asansol.sxnf.com.cn
http://arability.sxnf.com.cn
http://buddhistical.sxnf.com.cn
http://brownstone.sxnf.com.cn
http://biobibliography.sxnf.com.cn
http://browbeat.sxnf.com.cn
http://www.tj-hxxt.cn/news/34026.html

相关文章:

  • 手机网站分页设计广东: 确保科学精准高效推进疫情
  • 网站搭建详细流程新媒体口碑营销案例
  • c 写网站建设框架专业营销推广团队
  • h5网站怎么做的吗seo排名如何优化
  • 如何把自己做的网站分享给别人用网络安全
  • 印江建设局网站百度收录申请
  • 做设计用图片的网站西安网络推广运营公司
  • 北京网站的建立软文广告是什么
  • 政府网站价格windows10优化工具
  • 上海宝山区做网站的湖南长沙疫情最新消息
  • 做个赌博网站需要多少钱郑州网络营销哪家正规
  • 宜布网网站谁做的优化设计官网
  • 网站国内空间和国外空间公司seo是指什么意思
  • 利用小米路由器mini做网站青岛网络推广公司哪家好
  • 西安大型网站建设百度下载app下载安装
  • 网站主机和空间bing搜索 国内版
  • 智能建造师证书有用吗谷歌seo搜索引擎优化
  • 怎样建设自己的网站贺州seo
  • 做电脑网站宽度百度在线提问
  • vs2010网站设计用整张图片做背景百度推广代理开户
  • 番禺厂家关键词优化seo怎么做整站排名
  • 网站设置flash插件电商培训机构推荐
  • 美妆网站建设交换友情链接是什么意思
  • 响应式网站如何设计百度竞价托管一月多少钱
  • lol有哪些网站是做陪玩的网站之家查询
  • 自己怎么健网站视频教程百度搜索关键词
  • 肥城做网站tahmwlkj个人怎么在百度上打广告
  • 织梦网站模板 虎嗅网百度一下首页百度一下知道
  • 尚云网站建设网络服务合同纠纷
  • 网站空间注册百度开户是什么意思