C# 实现 Word 加盖骑缝章效果

news2024/9/28 17:30:20

 

目录

实现效果

范例运行环境

Office DCOM 配置

设计实现

创建stamp图章类 

电子章图片的计算与定位

旋转图片方法

总结 


实现效果

在OA的自动化处理系统中,通过审批的最终节点,可能会对WORD文件加盖电子章,比如定位带有指定文字的Range周围加盖电子章,骑缝章,甚至水印图片。比如如下效果图:

54f76cb8e6914b3092a5e991c3a83ae1.png

 cd92a2943a0d460dba329084920e7f9c.png

范例运行环境

操作系统: Windows Server 2019 DataCenter

操作系统上安装 Office Word 2016 ,客户端使用的 Office Word 2019

.net版本: .netFramework4.7.1 或以上

开发工具:VS2019  C#

Office DCOM 配置

请参考我的文章《C# 读取Word表格到DataSet》有对Office DCOM详细配置介绍,这里不再赘述。 

设计实现

创建stamp图章类 

导出WORD文件可以传入多个图章类(如果需要的话),图章类主要包括实现如下设置:

1、可设置三种图片(标准的盖章图片、骑缝章图片、水印图片)

2、标准的盖章图片是否显示,不显示则可以只显示骑缝章或水印图片,这个可以模拟多次盖骑缝章的效果

3、定位盖章文字,可以设置一下 x、y的偏移量,以校准指定的模板文件,达到最佳重叠效果。

4、可设置各种章的翻转角度(可随机选取)

示例代码如下: 

public class stamp
        {
            public string stampImageFilename = "";  //盖章图片
            public string stampImageFilename2 = "";  //骑缝章图片
            public string stampImageFilename3 = "";  //水印章图片
            public bool stampImageVisible = true;  //主章是否可显示
            public string findWord = "";   //查找盖章定位文字
            public int findWordOffsetX = 0; //查找盖章文字后,章的定位偏移量
            public int findWordOffsetY = 0; //查找盖章文字后,章的定位偏移量
            public int stamp2X = 0; //骑缝章偏移量
            public int stamp2Y = 0; //骑缝章偏移量
            public int roteAngle = 0; //骑缝章翻转角度,12点方向为0度,顺时针计算角度
            public bool roteReFix = false; //骑缝章翻转角度重新计算适应图片(多见于对角线)
            public bool randomRoteAngle = false; //骑缝章是否按指定角度的最大随机值提取
            public int stampImageWidth = 0; //章宽度
            public int stampImageHeight = 0; //章高度
            public string stamp2Direction = "right";  //骑缝章盖章方向 默认right ,包括 left/top/bottom

            public int stampAngle = 0; //骑缝章翻转角度,12点方向为0度,顺时针计算角度
            public bool randomStampAngle = false; //骑缝章是否按指定角度的最大随机值提取

            public int stamp3X = 0; //水印章每页X
            public int stamp3Y = 0; //水印章每页Y
            public int stamp3Angle = 0; //水印章翻转角度,12点方向为0度,顺时针计算角度


        }

电子章图片的计算与定位

可以创建多个图章类添加 ArrayList 中进行方法传递, 初始值为public ArrayList Stamps = null;

创建方法  public string setWordStamps(string _filename,ArrayList Stamps)

实现的功能大致如下:

1、主章根据提供查找的关键字,如 “盖章处:”、“盖章:”,然后添加图片重叠在文字的上方周围

2、骑缝章根据页数进行分割计算,每页分隔宽度不小于 1 像素

3、骑缝章可选择“盖”在页面的上下左右位置,如果多个位置方向都需要“盖”,则传递多个 stamp 图章类

4、章可以随机和指定旋转角度

示例代码如下:

public string setWordStamps(string _filename,ArrayList Stamps){
            Object Nothing =System.Reflection.Missing.Value;
			string _file="",_path=Path.GetDirectoryName(_filename)+"\\tempbfile\\",_ext="";

			_file=Path.GetFileNameWithoutExtension(_filename);
			_ext=Path.GetExtension(_filename);
			string _validfilename=Guid.NewGuid().ToString()+_ext;
			string _lastfile=_path+_validfilename;
            string _pdfFile = _path + Guid.NewGuid().ToString() + ".pdf";

            System.IO.File.Copy(_filename,_lastfile,true);
			if(!File.Exists(_lastfile))
			{
				return "";
			}


            //取得Word文件保存路径
            object filename=_lastfile;
			//创建一个名为WordApp的组件对象
			Word.Application WordApp=new Word.Application();
            
			//创建一个名为WordDoc的文档对象
			WordApp.DisplayAlerts=Word.WdAlertLevel.wdAlertsNone;
			Word.Document WordDoc=WordApp.Documents.Open(ref filename,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);
            WordDoc.SpellingChecked = false;
            WordDoc.ShowSpellingErrors = false;
            WordDoc.ActiveWindow.View.Type = Word.WdViewType.wdNormalView;

//遍历stamp图章类
    foreach (stamp Stamp in Stamps)
    {
                    bool isfirst = true;
                    int iii = 0;
                    int selectStart = 0;
                    ArrayList restoreRange = new ArrayList();
                    while (true)
                    {
                        iii++;
                        bool findstamptext = false;
                        if (Stamp.findWord != "")
                        {
                            
                            WordApp.Selection.Range.Start = selectStart;
                            
                            Word.Find fnd = WordApp.Selection.Find;
                            
                            Object findText = Stamp.findWord;
                            Object matchCase = false;
                            Object matchWholeWord = Type.Missing;
                            Object matchWildcards = false;
                            Object matchSoundsLike = false;
                            Object matchAllWordForms = false;
                            Object forward = true;
                            Object wrap = Word.WdFindWrap.wdFindContinue;
                            Object format = false;
                            Object replaceWith = "";
                            Object replace = Type.Missing; ;
                            Object matchKashida = Type.Missing;
                            Object matchDiacritics = Type.Missing;
                            Object matchAlefHamza = Type.Missing;
                            Object matchControl = Type.Missing;
                            if (fnd.Execute(ref findText, ref matchCase, ref matchWholeWord, ref matchWildcards, ref matchSoundsLike, ref matchAllWordForms,
                                ref forward, ref wrap, ref format, ref replaceWith, ref replace, ref matchKashida, ref matchDiacritics, ref matchAlefHamza, ref matchControl))
                            {
                                selectStart = WordApp.Selection.Range.Start;
                                restoreRange.Add(WordApp.Selection.Range);
                                findstamptext = true;
                            }
                            else
                            {
                                findstamptext = false;

                            }
                        }
                        if (findstamptext == false)
                        {
                            break;
                        }
                        Word.InlineShape pic = WordApp.Selection.Range.InlineShapes.AddPicture(Stamp.stampImageFilename, false, true);
                        Word.Shape picshape = pic.ConvertToShape();
                       
                        picshape.WrapFormat.Type = Word.WdWrapType.wdWrapNone;
                        if (Stamp.stampImageWidth != 0)
                        {
                            picshape.Width = Stamp.stampImageWidth;
                        }
                        if (Stamp.stampImageHeight != 0)
                        {
                            picshape.Height = Stamp.stampImageHeight;
                        }
                        float pagewidth = 0;
                        float pageheight = 0;
                        if (findstamptext == true)
                        {
                            if (Stamp.stampAngle > 0)
                            {
                                Random rnd = new Random();
                                picshape.Rotation = Stamp.randomStampAngle == false ? Stamp.stampAngle : rnd.Next(Stamp.stampAngle);
                            }
                            pagewidth = WordApp.Selection.PageSetup.PageWidth;
                            pageheight = WordApp.Selection.PageSetup.PageHeight;
                            int ox = 0; int oy = 0; int ow = 0; int oh = 0;
                            WordApp.Windows[1].GetPoint(out ox, out oy, out ow, out oh, WordApp.Selection.Range);

                            WordApp.Selection.Range.Text = "";

                            picshape.RelativeHorizontalPosition = Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage;
                            picshape.RelativeVerticalPosition = Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionPage;


                            picshape.Left = (float)(ox * 0.405402299) - (picshape.Width / 2);

                            picshape.Top = WordApp.Selection.Range.Information[Word.WdInformation.wdVerticalPositionRelativeToPage] - (picshape.Height / 2);
                            if ((bool)WordApp.Selection.Range.Information[Word.WdInformation.wdWithInTable] == true)
                            {
                                picshape.RelativeHorizontalPosition = Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionCharacter;
                                picshape.RelativeVerticalPosition = Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionLine;
                                picshape.Left = 0;
                                picshape.Top = 0;
                            }

                        }
                        picshape.Left = picshape.Left + Stamp.findWordOffsetX;
                        picshape.Top = picshape.Top + Stamp.findWordOffsetY;
                        if (Stamp.stampImageVisible == false)
                        {
                            picshape.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
                        }
                        if (Stamp.stampImageFilename2 != ""&&isfirst==true)
                        {
                            int ra = Stamp.roteAngle;
                            if (ra > 0)
                            {
                                Random rnd = new Random();
                                ra = Stamp.randomRoteAngle == false ? ra : rnd.Next(ra);
                            }

                            Bitmap cc = (Bitmap)Image.FromFile(Stamp.stampImageFilename2);
                            Bitmap bb = Rotate(cc, -ra, Stamp.roteReFix);
WordDoc.Windows[1].Panes[1].Pages;
                            int pages2 = WordDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages, ref Nothing);
                            
                            
                            if (pages2 == 1)
                            {
                                pages2 = 0; //如果一页就不盖骑缝章
                            }
                            for (int pi = 1; pi <= pages2; pi++)
                            {

                                Word.Range pagerange = WordDoc.GoTo(Word.WdGoToItem.wdGoToPage, Word.WdGoToDirection.wdGoToAbsolute, pi.ToString());
                                int rx = (pi - 1) * bb.Width / pages2;
                                int ry = 0;
                                int rw = bb.Width / pages2;
                                int rh = bb.Height;
                                if (Stamp.stamp2Direction == "bottom")
                                {
                                    rx = 0;
                                    ry = (pi - 1) * bb.Height / pages2;
                                    rw = bb.Width;
                                    rh = bb.Height / pages2;

                                }
                                else if (Stamp.stamp2Direction == "left")
                                {
                                    rx = (pages2 - pi) * bb.Width / pages2;
                                    ry = 0;
                                    rw = bb.Width / pages2;
                                    rh = bb.Height;

                                }
                                else if (Stamp.stamp2Direction == "top")
                                {
                                    rx = 0;
                                    ry = (pages2 - pi) * bb.Height / pages2;
                                    rw = bb.Width;
                                    rh = bb.Height / pages2;
                                }
                                if (rw < 1 || rh < 1)
                                {
                                    continue;
                                }

                                Bitmap sepbitmap1 = bb.Clone(new System.Drawing.Rectangle(rx, ry, rw, rh), System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
                                string temppng = "d:\\" + System.Guid.NewGuid().ToString() + ".png";
                                sepbitmap1.Save(temppng);

                                Word.InlineShape pic2 = pagerange.InlineShapes.AddPicture(temppng, false, true);
                                Word.Shape picshape2 = pic2.ConvertToShape();
                                picshape2.WrapFormat.Type = Word.WdWrapType.wdWrapNone;

                                picshape2.Width = picshape.Width / pages2;
                                picshape2.Height = picshape.Height;
                                if (Stamp.stamp2Direction == "bottom" || Stamp.stamp2Direction == "top")
                                {
                                    picshape2.Width = picshape.Width;
                                    picshape2.Height = picshape.Height / pages2;

                                }
                                picshape2.RelativeHorizontalPosition = Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage;
                                picshape2.RelativeVerticalPosition = Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionPage;

                                picshape2.Left = pagewidth - picshape2.Width;
                                picshape2.Top = Stamp.stamp2Y;
                                if (Stamp.stamp2Direction == "bottom")
                                {
                                    picshape2.Left = Stamp.stamp2X;
                                    picshape2.Top = pageheight - picshape2.Height;

                                }
                                else if (Stamp.stamp2Direction == "left")
                                {
                                    picshape2.Left = 0;
                                    picshape2.Top = Stamp.stamp2Y;

                                }
                                else if (Stamp.stamp2Direction == "top")
                                {
                                    picshape2.Left = Stamp.stamp2X;
                                    picshape2.Top = 0;

                                }
                                resultReport += string.Format("stamp2 {2} left: {0} top:{1} width:{3} height:{4}<br>", picshape2.Left, picshape2.Top,pi,picshape2.Width,picshape2.Height);

                                File.Delete(temppng);
                            }
                        }//stamp2
                        if (Stamp.stampImageFilename3 != ""&&isfirst==true)
                        {
                            int ra = Stamp.stamp3Angle;

                            if (ra > 0)
                            {
                                Random rnd = new Random();
                                ra = Stamp.randomRoteAngle == false ? ra : rnd.Next(ra);
                            }

                            Bitmap cc = (Bitmap)Image.FromFile(Stamp.stampImageFilename3);
                            Bitmap bb = Rotate(cc, -ra, true);
                            int pages2 = WordDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages, ref Nothing);
                            resultReport += string.Format(" PageCount3:{0}<br>", pages2);
                            for (int pi = 1; pi <= pages2; pi++)
                            {

                                Word.Range pagerange = WordDoc.GoTo(Word.WdGoToItem.wdGoToPage, Word.WdGoToDirection.wdGoToAbsolute, pi.ToString());
                                int rx = (pi - 1) * bb.Width / pages2;
                                rx = 0;
                                int ry = 0;
                                int rw = bb.Width;
                                int rh = bb.Height;

                                Bitmap sepbitmap1 = bb.Clone(new System.Drawing.Rectangle(rx, ry, rw, rh), System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
                                string temppng = "d:\\" + System.Guid.NewGuid().ToString() + ".png";

                                Word.InlineShape pic2 = pagerange.InlineShapes.AddPicture(temppng, false, true);
                                Word.Shape picshape2 = pic2.ConvertToShape();
                                picshape2.WrapFormat.Type = Word.WdWrapType.wdWrapNone;

                                picshape2.Width = picshape.Width;
                                picshape2.Height = picshape.Height;

                                picshape2.RelativeHorizontalPosition = Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage;
                                picshape2.RelativeVerticalPosition = Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionPage;

                                picshape2.Left = Stamp.stamp3X;
                                //                       picshape2.Left = Stamp.stamp2X;
                                picshape2.Top = Stamp.stamp2Y;

                                File.Delete(temppng);
                            }
                        }//stamp3
                        isfirst = false;
                    }// while
                    foreach (Word.Range range in restoreRange)
                    {
                        range.Text = Stamp.findWord;
                    }


    }//foreach

	WordDoc.Save();

    WordDoc.Close(ref Nothing, ref Nothing, ref Nothing);
	//关闭WordApp组件对象
	WordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
	return _lastfile;

}

旋转图片方法

        public Bitmap Rotate(Bitmap b, int angle,bool fix=false)
        {
            angle = angle % 360;

            //弧度转换
            double radian = angle * Math.PI / 180.0;
            double cos = Math.Cos(radian);
            double sin = Math.Sin(radian);

            //原图的宽和高
            int w = b.Width;
            int h = b.Height;
            int ow = w;
            int oh = h;
            int d = ((int)Math.Sqrt(Math.Pow(w - 0, 2) + Math.Pow(h- 0, 2))+1);
            if (fix == true)
            {
                w = d;
                h = d;
            }

            int W = (int)(Math.Max(Math.Abs(w * cos - h * sin), Math.Abs(w * cos + h * sin)));
            int H = (int)(Math.Max(Math.Abs(w * sin - h * cos), Math.Abs(w * sin + h * cos)));

            //目标位图
            Bitmap dsImage = new Bitmap(w, h);
            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(dsImage);

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            //计算偏移量
            System.Drawing.Point Offset = new System.Drawing.Point((W - w) / 2, (H - h) / 2);

            //构造图像显示区域:让图像的中心与窗口的中心点一致
            System.Drawing.Rectangle rect = new System.Drawing.Rectangle(fix==false?0:(d-ow)/2, fix == false ? 0 : (d-oh)/2, ow, oh);
//            System.Drawing.Rectangle rect = new System.Drawing.Rectangle(Offset.X, Offset.Y, w, h);
 //           System.Drawing.Point center = new System.Drawing.Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
            System.Drawing.Point center = new System.Drawing.Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
            
            g.TranslateTransform(center.X, center.Y);
            g.RotateTransform(360 - angle);

            //恢复图像在水平和垂直方向的平移
            g.TranslateTransform(-center.X, -center.Y);
            g.DrawImage(b, rect);

            //重至绘图的所有变换
            g.ResetTransform();

            g.Save();
            g.Dispose();
            //dsImage.Save("yuancd.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
            return dsImage;
        }

总结 

以上是实现设计的一些参考代码,在实际的使用中,可能还会遇到如下问题:

1、定位关键字的叠加效果不好,因此针对每一个模板文件均需要调整图片的x、y偏移量,以达到最佳效果

2、对于超多页面的文件(如几万页),骑缝的效果可能不佳,可以采取调整图片像素宽度,或拆分模板文件进行处理

示例代码仅作参考,欢迎大家评论指教!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1409871.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

微软人工智能办公AI工具 Copilot Pro 11项 Copilot 功能

Copilot&#xff08;曾用名 Bing Chat 和 Bing Chat Enterprise&#xff09;在此期间成为了许多用户的日常AI伴侣&#xff0c;并在正式发布后将继续为用户提供AI驱动的网络聊天体验。 微软Copilot官方网址链接&#xff1a;Microsoft Copilot: 你的日常 AI 助手 Copilot详情&am…

密码强度效果

文章目录 一、第一种规则实现 总结如有启发&#xff0c;可点赞收藏哟~ 一、第一种 规则 先展示效果 具体规则 长度显最小8位需有字母大小写需有数字需有特殊字符&#xff08;暂无限制字符类型&#xff09; 实现 定义组件password-strength.vue <template><div …

Github 2024-01-24开源项目日报 Top10

根据Github Trendings的统计&#xff0c;今日(2024-01-24统计)共有10个项目上榜。根据开发语言中项目的数量&#xff0c;汇总情况如下&#xff1a; 开发语言项目数量TypeScript项目3Dart项目2非开发语言项目2Go项目1Rust项目1Shell项目1Dockerfile项目1Jupyter Notebook项目1J…

最佳的reCAPTCHA v2验证码解析器,使用API或扩展自动解析reCAPTCHA v2

最佳的reCAPTCHA v2验证码解析器&#xff0c;使用API或扩展自动解析reCAPTCHA v2 reCAPTCHA v2提出了一个严峻的挑战&#xff0c;需要先进的解决方案。在本文中&#xff0c;我们揭示了验证码解析技术的巅峰&#xff1a;Capsolver。这个卓越的解决方案涵盖了解决reCAPTCHA v2挑战…

2021-01-25

不积跬步无以至千里&#xff0c;不积小流无以成江河&#xff0c;和自己的昨天比&#xff0c;而不是和别人去比。 今日安排&#xff1a; 1.做3道算法题 2.看微信公众号博客&#xff0c;了解技术 //使用callablefuturetask来 获取异步线程的执行结果 写一个类实现callable接…

eNSP学习——交换机配置Trunk接口

目录 原理概述 实验内容 实验目的 实验步骤 实验拓扑 实验编址&#xff1a; 试验步骤 基本配置 创建VLAN&#xff0c;配置Access接口 配置Trunk接口 思考题 原理概述 在以太网中&#xff0c;通过划分VLAN来隔离广播域和增强网络通信的安全性。以太网通常由多台交换机组…

无公网IP实现远程访问MongoDB文件数据库【内网穿透】

最近&#xff0c;我发现了一个超级强大的人工智能学习网站。它以通俗易懂的方式呈现复杂的概念&#xff0c;而且内容风趣幽默。我觉得它对大家可能会有所帮助&#xff0c;所以我在此分享。点击这里跳转到网站。 文章目录 前言1. 安装数据库2. 内网穿透2.1 安装cpolar内网穿透2…

多维时序 | Matlab实现RIME-TCN-Multihead-Attention霜冰算法优化时间卷积网络结合多头注意力机制多变量时间序列预测

多维时序 | Matlab实现RIME-TCN-Multihead-Attention霜冰算法优化时间卷积网络结合多头注意力机制多变量时间序列预测 目录 多维时序 | Matlab实现RIME-TCN-Multihead-Attention霜冰算法优化时间卷积网络结合多头注意力机制多变量时间序列预测效果一览基本介绍程序设计参考资料…

Windows主机Navicat远程连接到Ubuntu18.04虚拟机MySQL

1. 在虚拟机上安装MySQL sudo apt-get install mysql-server sudo apt-get install libmysqlclient-dev 2. 检查安装 sudo netstat -tap | grep mysql 3. 查看默认密码 sudo cat /etc/mysql/debian.cnf 4. 用查看到的密码登录MySQL server&#xff0c;修改root用户的密码 …

【STM32】STM32学习笔记-硬件SPI读写W25Q64(40)

00. 目录 文章目录 00. 目录01. SPI简介02. W25Q64简介03. SPI相关API3.1 SPI_Init3.2 SPI_Cmd3.3 SPI_I2S_SendData3.4 SPI_I2S_ReceiveData3.5 SPI_I2S_GetFlagStatus3.6 SPI_I2S_ClearFlag3.7 SPI_InitTypeDef 04. 硬件SPI读写W25Q64接线图05. 硬件SPI读写W25Q64示例06. 程序…

【Leetcode】2865. 美丽塔 I

文章目录 题目思路代码结果 题目 题目链接 给你一个长度为 n 下标从 0 开始的整数数组 maxHeights 。 你的任务是在坐标轴上建 n 座塔。第 i 座塔的下标为 i &#xff0c;高度为 heights[i] 。 如果以下条件满足&#xff0c;我们称这些塔是 美丽 的&#xff1a; 1 < hei…

Nginx高级设置

文章目录 一、Nginx高级设置Nginx状态页Nginx第三方模块Nginx变量使用内置变量自定义变量 Nginx自定义访问日志自定义默认格式日志自定义json格式日志 Nginx压缩功能https功能https配置参数自签名证书 虚拟主机 二、Nginx代理服务三、代理服务常见模式四、Nginx代理服务支持协议…

C++:使用tinyXML生成矢量图svg

先说一下tinyXML库的配置&#xff1a; 很简单&#xff0c;去下面官网下载 TinyXML download | SourceForge.net 解压后是这样 直接将红框中的几个文件放到项目中即可使用 关于svg文件&#xff0c;SVG是基于XML的可扩展矢量图形&#xff0c;svg是xml文件&#xff0c;但是xml…

分布变化下的Test-Time adaption 综述

论文 https://arxiv.org/abs/2303.15361 代码 https://github.com/tim-learn/awesome-test-time-adaptation &#xff08;其实这是相关领域代码和论文合集之类的东西&#xff09; Abstract 机器学习方法努力在训练过程中获得一个鲁棒模型&#xff0c;即使在分布变化的情况下…

如何使用Docker部署导航页工具Dashy并实现任意浏览器远程访问——“cpolar内网穿透”

文章目录 简介1. 安装Dashy2. 安装cpolar3.配置公网访问地址4. 固定域名访问 简介 Dashy 是一个开源的自托管的导航页配置服务&#xff0c;具有易于使用的可视化编辑器、状态检查、小工具和主题等功能。你可以将自己常用的一些网站聚合起来放在一起&#xff0c;形成自己的导航…

利用 “diart“ 和 OpenAI 的 Whisper 简化实时转录

利用 "diart" 和 OpenAI 的 Whisper 简化实时转录 工作原理 Diart 是一个基于人工智能的 Python 库&#xff0c;用于实时记录说话者语言&#xff08;即 "谁在什么时候说话"&#xff09;&#xff0c;它建立在 pyannote.audio 模型之上&#xff0c;专为实时…

Linux破解密码

破解root密码&#xff08;Linux 7&#xff09; 1、先重启——e 2、Linux 16这一行 末尾加rd.break&#xff08;不要回车&#xff09;中断加载内核 3、再ctrlx启动&#xff0c;进入救援模式 4、mount -o remount&#xff0c;rw /sysroot/——&#xff08;mount挂载 o——opti…

PySide6/PyQt6中Qt窗口标志/窗口属性汇总,如何正确的设置窗口标志/窗口属性

文章目录 📖 介绍 📖🏡 环境 🏡📒 使用方法 📒📚 窗口标志汇总📚 窗口属性汇总📝 使用方法📝 注意事项⚓️ 相关链接 ⚓️📖 介绍 📖 在Qt框架中,窗口标志(window flags)是用于控制窗口的各种属性和行为的强大工具。它们通过设置窗口的属性,如边框…

面试知识点:notify是随机唤醒线程吗(唤醒线程顺序)?

做 Java 开发的小伙伴&#xff0c;对 wait 方法和 notify 方法应该都比较熟悉&#xff0c;这两个方法在线程通讯中使用的频率非常高&#xff0c;但对于 notify 方法的唤醒顺序&#xff0c;有很多小伙伴的理解都是错误的&#xff0c;有很多人会认为 notify 是随机唤醒的&#xf…

力扣日记1.25-【回溯算法篇】39. 组合总和

力扣日记&#xff1a;【回溯算法篇】39. 组合总和 日期&#xff1a;2023.1.25 参考&#xff1a;代码随想录、力扣 39. 组合总和 题目描述 难度&#xff1a;中等 给你一个 无重复元素 的整数数组 candidates 和一个目标整数 target &#xff0c;找出 candidates 中可以使数字和…