例如.
public string AA {get;set;}
public string BBB {get;set;}
public string CCCCC {get;set;}
....
假設你需要複製類似上述,但又遇到欄位長度不一致, 可以試試正規表示式,事半功倍
範例: 有一堆網址,我想要全部加入html 的<a>標籤,且名稱也是網址名稱
該如何處理?
AA.com
BBB.com
CCCC.com
DD.com
E.com
FF.com
GGGGG.com
完成後

public class Global { public static string _content = ""; }
public void RotatePDFFiles_bak(string fileList, string outMergeFile, List<int> rotations) { PdfReader reader = new PdfReader(fileList); int pagesCount = reader.NumberOfPages; for (int n = 1; n <= pagesCount; n++) { PdfDictionary page = reader.GetPageN(n); PdfNumber rotate = page.GetAsNumber(PdfName.ROTATE); //int rotation = rotate == null ? 90 : (rotate.IntValue + 90) % 360; int rotation = 0; if (rotations[n - 1] == 90) { rotation = 180; //(90 + 90) % 360; //向左橫置的pdf逆轉90 } else if (rotations[n - 1] == 270) { rotation = 0; // (270 + 90) % 360; } page.Put(PdfName.ROTATE, new PdfNumber(rotation)); } PdfStamper stamper = new PdfStamper(reader, new FileStream(outMergeFile, FileMode.Create)); stamper.Close(); reader.Close(); }
var pdfFile = "xxx.pdf"; FileContentResult file = File(pdfFile, "application/vnd.ms-excel"); Session["pdfFile"] = file; // 將檔案儲存在 Session