我使用using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using RGiesecke.DllExport;
using System.IO.Compression;
using System.Xml.Linq;
namespace DocxProperties
{
public class DocxPropertyGetter
{
[DllExport(nameof(GetDocxProp), CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.AnsiBStr)]
public static string GetDocxProp([MarshalAs(UnmanagedType.AnsiBStr)] string wordPath, [MarshalAs(UnmanagedType.AnsiBStr)] string propName)
{
try
{
using (var fileStream = File.Open(wordPath, FileMode.Open))
using (var parentArchive = new ZipArchive(fileStream))
{
return GetPropName(parentArchive, propName);
}
}
catch (Exception ex)
{
return ex.ToString();
}
}
private static string GetPropName(ZipArchive parentArchive, string propName)
{
var core = parentArchive.Entries.FirstOrDefault(e => e.FullName == "docProps/core.xml");
using (var coreStream = core.Open())
{
var doc = XDocument.Load(coreStream);
foreach (var descendant in doc.Descendants())
{
if (descendant.Name.LocalName.Equals(propName, StringComparison.InvariantCultureIgnoreCase))
{
return descendant.Value;
}
}
}
return string.Empty;
}
}
}
CSS属性在所有方面都有Option Explicit
#If Win64 Then
Private Declare PtrSafe Function LoadLibraryA Lib "kernel32" (ByVal lpLibFileName As String) As Long
Private Declare PtrSafe Function GetDocxProp Lib "DocxProperties64.dll" (ByVal wordPath As String, ByVal propName As String) As String
#Else
Private Declare Function LoadLibraryA Lib "kernel32" (ByVal lpLibFileName As String) As Long
Private Declare Function GetDocxProp Lib "DocxProperties64.dll" (ByVal wordPath As String, ByVal propName As String) As String
#End If
Sub TestAuthorName()
Dim dllPath As String
#If Win64 Then
dllPath = "DocxProperties64.dll"
#Else
dllPath = "DocxProperties32.dll"
#End If
Call LoadLibrary(dllPath)
Debug.Print GetDocxProp(ThisWorkbook.path & "\EmptyDoc.docx", "creator")
End Sub
Private Function LoadLibrary(dllName As String) As Long
Dim path As String
path = ThisWorkbook.path & "\" & dllName
LoadLibrary = LoadLibraryA(path)
End Function
边框。
目前所有侧面的阴影厚度均为5px。但我需要这些边框的顶部和底部厚度为5px,左右两侧为10像素。
我知道可以使用<div>
执行此操作。
但我需要找到一个仅使用box-shadow
的解决方案。
有可能吗?
border-left,boder-right,border-top,border-bottom
box-shadow
答案 0 :(得分:4)
使用多个box-shadow
值。
div {
box-shadow: inset 10px 0px 0px #888888,
inset -10px 0px 0px #888888,
inset 0 5px 0px #888888,
inset 0 -5px 0px #888888;
}
更改x和y因子以增加/减少每侧的阴影(边框)的厚度。
div {
width: 300px;
height: 100px;
background-color: yellow;
box-shadow: inset 10px 0px 0px #888888,inset -10px 0px 0px #888888, inset 0 5px 0px #888888, inset 0 -5px 0px #888888;
}
&#13;
<div></div>
&#13;
答案 1 :(得分:0)
您可以使用多个以逗号分隔的值定义来实现此目的:
div {
width: 300px;
height: 100px;
background-color: yellow;
box-shadow: inset 0px 5px 0px 0px #888888, inset -20px 0px 0px 0px #ff0000, inset 0px -15px 0px 0px #00ff00, inset 20px 0px 0px 0px #0000ff;
}
&#13;
<div></div>
&#13;
答案 2 :(得分:0)
你可以试试这个:
div {
width: 300px;
height: 100px;
background-color: yellow;
box-shadow: inset 10px 0px 0px 5px #888888,inset -10px 0px 0px 5px #888888
}