分类目录归档:其它

word中的vba,批量更改表格宽度,单元格宽度等

Sub Macro1()
Dim MyTable As Table
For Each MyTable In ActiveDocument.Tables
MyTable.PreferredWidthType = wdPreferredWidthPercent
MyTable.PreferredWidth = 100
If MyTable.Columns.Count = 4 Then
MyTable.Columns(4).PreferredWidth = CentimetersToPoints(1.29)
End If

Next
End Sub

这里判断有四列的表格,才操作

类推,也可以通过判断单元格的标题内容符合要求,才操作

Sub 获取表格表头()
    Dim tbl As Table
    Dim colIndex As Integer
    Dim 表头内容 As String
    
    ' 遍历文档中所有表格
    For Each tbl In ActiveDocument.Tables
        Debug.Print "表格 " & tbl.Index & " 的表头:"
        
        ' 遍历第一行的所有单元格(表头)
        For colIndex = 1 To tbl.Rows(1).Cells.Count
            ' 获取单元格文本(去除多余的段落标记)
            表头内容 = Replace(tbl.Rows(1).Cells(colIndex).Range.Text, Chr(13) & Chr(7), "")
            Debug.Print "第 " & colIndex & " 列表头:" & 表头内容
        Next colIndex
        
        Debug.Print "-------------------------"
    Next tbl
    
    MsgBox "表头信息已输出到立即窗口(按Ctrl+G查看)"
End Sub

owncloud个人网盘安装

owncloud个人网盘安装
1\直接在官网下载压缩包,而不要去github下载源码,压缩包解压缩后是php,里面有可执行文件
2\php-7.4,centos7的环境下,php需要安装很多包,其中libzip需要自己编译,版本不符合,编译还需要cmake的高版本,自带的是2.x,需要3.x
3\其它的没什么要注意的的,主要是上面的php编译,需要很多依赖包
安装过程如果需要帮助,可以11477935我

ffmpeg 压缩视频,两个报错

把分辨率缩小一倍,其它不变,由130M压缩到16M,效果还可以.
影响压缩的参数,码率=文件大小(KB)*8/播放长度s.

第一个报错
./ffmpeg.exe -i qhkj2.mp4 scale=1639:819 v1.mp4
报错:
[NULL @ 00000259c852ed40] Unable to find a suitable output format for ‘scale=1639:819’
scale=1639:819: Invalid argument

原因:You need to enter -vf before scale to tell FFmpeg that you want to use a video filter. Also, it should be specified after the filename of the image as it’s an output option, not an input option. You can put it just before the output name:
大概的意思是说,你需要在scale参数前面输入-vf参数,用来告知ffmpeg,需要使用video的过滤器,-vf应该放到视频文件名后面,-vf是一个输出视频的选项,不是导入视频的选项,把-vf放到输出视频的名字前面,例如v1.mp4前面,如下
解决办法:
./ffmpeg.exe -i qhkj2.mp4 -vf scale=1639:819 v1.mp4

第二个报错
./ffmpeg.exe -i qhkj2.mp4 -vf scale=1639:819 v1.mp4
报错:
[libx264 @ 0000027ff8717a00] width not divisible by 2 (1639×819)
Error initializing output stream 0:0 — Error while opening encoder for output stream #0:0 – maybe incorrect parameters
such as bit_rate, rate, width or height
[aac @ 0000027ff8521180] Qavg: 139.243
[aac @ 0000027ff8521180] 2 frames left in the queue on closing

原因:
出现该错误的原因是在于:视频的宽度必须是32的倍数,高度必须是2的倍数
解决方法:
if (screen_width % 32 != 0)
{
screen_width = screen_width / 32 * 32;
}
if (screen_height % 2 != 0)
{
screen_height = screen_height / 2 * 2;
}
最终命令:./ffmpeg.exe -i qhkj2.mp4 -vf scale=1632:820 v1.mp4
成功.

全新途胜carlife的音乐格式

不想使用mp3,音质差
不支持其他无损格式,只能用wav

网上下载了一些ape格式的无损音乐文件,需要转化为wav,使用ffmpeg即可
ffmpeg -i music.ape music.wav

有些wav文件无法播放,全是电流声,但是用别的播放器是可以的,查看可能是声道问题,重新使用ffmpeg混音就可以
/usr/bin/ffmpeg -i /home/yanjin/music/wav/music.wav -af “pan=stereo|c0

搞定.